serverless-console icon indicating copy to clipboard operation
serverless-console copied to clipboard

Trying to populate non string value into a string for variable ${opt:stage}

Open jeremyprioux opened this issue 4 years ago • 3 comments

Hello,

When I want to add a new service, I have the following error about stages configuration:

image

Is it some configuration to make on my side or a bug ?

jeremyprioux avatar Mar 02 '20 10:03 jeremyprioux

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.

domagojk avatar Mar 02 '20 13:03 domagojk

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?

jeremyprioux avatar Mar 03 '20 09:03 jeremyprioux

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

domagojk avatar Mar 03 '20 10:03 domagojk