serverless-console
serverless-console copied to clipboard
Trying to populate non string value into a string for variable ${opt:stage}
Hello,
When I want to add a new service, I have the following error about stages configuration:
Is it some configuration to make on my side or a bug ?
Hi there!
When serverless framework "service" is used, the extension runs what you define in "print command". "stages" are used only for figuring out which logs to show, so only a stage name is needed. (because logs are defined as /aws/lambda/serviceName-stage-funName
)
I guess you would get this error if you run serverless print
on your terminal and would be fixed if you define a stage. The same goes here, you should define a stage if your serverless.yml doesn't have a fallback option. Something like this serverless print --stage staging
I get why this may be confusing, and I intend to change the way stages are defined so a print command can be specified for each stage, but for now you will have to define at least one stage so the print command can work.
Thanks for your quick answer !
Adding --stage
in the print command makes it work. So I need to add 3 services for each of my serverless projects if I have 3 stages, right?
If you use the same functions in all stages (which is the usual), then all 3 stages should work even tough your print command defines only one.
But, if you have different functions per stage, only in that case you need to add additional services