Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rego_type_error undefined function for custom built-in function during bundle build #2738

Closed
gshively11 opened this issue Sep 29, 2020 · 0 comments · Fixed by #2741
Closed
Labels

Comments

@gshively11
Copy link
Contributor

Expected Behavior

After creating and registering a custom built-in function and compiling a custom opa binary, opa build --bundle... should build a bundle for policy referencing the custom built-in function.

Actual Behavior

It fails with the following error:

error: 1 error occurred: /path/to/policy.rego:11: rego_type_error: undefined function <name_of_custom_func>

Steps to Reproduce the Problem

  • OPA version 0.23.2

@patrick-east reproduced this using the example custom built-in in this comment.

Additional Info

This error does not occur when testing the same policy using opa run.

patrick-east pushed a commit that referenced this issue Sep 30, 2020
The build and check commands were retrieving registered builtins too
early during initial execution, which did not give enough time for
custom binaries to register custom builtin functions. This change
sets the initial capabilities flag to nil instead, and then retrieves built-ins
immediately prior to instantiating a new compiler. This prevents an
undefined function rego_type_error during the build and check commands.
Fixes #2738.

This is my commit message

Signed-off-by: Grant Shively <gshively@godaddy.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants