-
-
Notifications
You must be signed in to change notification settings - Fork 62
Description
Hi,
I'm very excited to have come across this project, and want to incorporate it into some of my own serverless-based microservices. I just did a quick test and noticed that running serverless package --stage local does not allow custom variables/parameters to be read correctly from my serverless.local.yml configuration file. It reports that the variables are missing. If I supply the parameters using the --param flag, it will pick them up, but i would prefer to not pass each one in individually each time I want to package or deploy my service.
Here's an example of the output from running serverless package --stage local
serverless package --stage local
Environment: darwin, node 18.20.3, framework 3.49.0
Docs: github.com/oss-serverless/serverless
Error:
Cannot resolve serverless.yml: Variables resolution errored with:
- Cannot resolve variable at "custom.TestParam": The param "MyCustomParam" cannot be resolved from stage params. If you are using Serverless Framework Compose, make sure to run commands via Compose so that all parameters can be resolved
And an example for specifying the param in the command
serverless package --stage local --param="MyCustomParam=test"
Packaging online-library-oss for stage local (eu-west-1)
Compiling with Typescript...
Using local tsconfig.json - tsconfig.json
Typescript compiled.
✔ Service packaged (57s)
I have uploaded a minimal serverless project that reproduces this behavior here.
In serverless.yml, I have defined, under custom:
custom:
region: ${opt:region, 'us-east-1'}
Configuration: ${opt:Configuration, 'serverless.${self:provider.stage}.yml'}
TestParam: ${param:MyCustomParam, file(${self:custom.Configuration}):MyCustomParam}
Under the provider definition, I have stage defined as: stage: ${opt:stage, 'local'}.
The "other" serverless seems to support this just fine, so I was wondering if there may be something that I'm doing wrong, or if the syntax may have changed in oss-serverless?
Thank you!