compose icon indicating copy to clipboard operation
compose copied to clipboard

unrecognized CLI options: "--stage" when running "sls myService:doctor"

Open timo92 opened this issue 3 years ago • 3 comments

Are you certain it's a bug?

  • [X] Yes, it looks like a bug

Are you using the latest version?

  • [X] Yes, I'm using the latest version

Is there an existing issue for this?

  • [X] I have searched existing issues, it hasn't been reported yet

Issue description

When executing sls myService:doctor the comand fails with

Error: Detected unrecognized CLI options: "--stage".

Currently one has to manually change the working directory and execute the command locally. Serverless compose seems to add "--stage dev" to all commands per default.

Service configuration (serverless-compose.yml) content

module.exports = {
  services: {
    myService: {
      path: "some/path",
    },
  },
};

Command name and used flags

serverless myService:doctor

Command output

serverless > Invoking "doctor" on service "myService"
myService > Running "serverless doctor --stage dev"
Error:

timo92 avatar Jul 22 '22 15:07 timo92

Hey @timo92 - thanks for reporting and sorry you've run into trouble. That's true this is the case, but the thing is, serverless doctor command will never really work in context of a specific service - it only captures the deprecations of last serverless command, so you can just run sls doctor and it will print out the deprecations from last command, running it against a service wouldn't really change anything.

pgrzesik avatar Jul 25 '22 12:07 pgrzesik

Hey @pgrzesik, thank you for getting back to me and clearing up the functionallity of sls doctor. The reason why I attempted to run the command on the service level (besides not finding any documentation on it on the serverless website) was the error message I received when executing it at the root of my monorepo from where I deployed the service. I.e. running sls myService:deploy yields

myService > 1 deprecation found: run 'serverless doctor' for more details

and then running serverless doctor errors with

Command "doctor" doesn't exist. Available commands: deploy, remove, info, logs, outputs, refresh-outputs. If this is a service-specific command, run it using the component name: "serverless <service-name>:doctor"

Not sure whether you want to support it or mention it in the documentation. Either could be helpful when being faced with the suggestion to run serverless doctor.

timo92 avatar Jul 25 '22 15:07 timo92

I see, I think I have a solution for it and it will be applied on Framework level (it does triaging how the commands should be handled), it should always assume "non-compose" context for doctor command

pgrzesik avatar Jul 26 '22 12:07 pgrzesik