-
Notifications
You must be signed in to change notification settings - Fork 4
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
buildEnvironment does not pass correct params to build process #15
Comments
Hi @timkaas, first off thanks for opening this issue. I had a look, and realized that you are totally right - this is likely because we only call More info and context can be found in these lines: As can be seen, Additionally, it can also be seen, that we default to options.buildEnvironment ||
Settings.BUILD_ENVIRONMENT; Per these notes above, I would say that it might be slightly more performant to only call I would suggest using Settings.BUILD_ENVIRONMENT = {
FOO_ENV: 'foo',
BAR_ENV: 'bar',
};
// this appends 'lambda' folder to the directory where `cdk` was invoked
// note that this should be the same as passing `directory` to each RustFunction as above
Settings.WORKSPACE_DIR = 'lambda'
const foo_lambda = new RustFunction(this, 'foo_lambda', {
package: 'foo',
// don't use `buildEnvironment` as we want to default to merged environment above
})
const bar_lambda = new RustFunction(this, 'bar_lambda', {
package: 'bar',
// don't use `buildEnvironment` as it will be ignored here
}) Please do try that out, and let me know how it goes. |
A few TODO items I see, and potential areas of improvement in terms of documentation and clarity purposes:
|
Using the latest build 1.2.1, it seems that specifying buildEnvironment as a param to multiple RustFunction instances causes only the first passed env vars for the first hit RustFunction instance to be passed for all following creations of RustFunction.
Minimum example:
With the rust code doing e.g.:
I'm getting the error when compiling the second rust function
environment variable "BAR_ENV" not defined
, however - the FOO_ENV is available for the second function. If reversing the order of the twoRustFunction
s, now BAR_ENV is available, and compilation will fail with FOO_ENV not defined.This issue can be worked-around by building each package individually by doing:
The text was updated successfully, but these errors were encountered: