Skip to content
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

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

Open
3 tasks done
timo92 opened this issue Jul 22, 2022 · 3 comments
Open
3 tasks done
Labels
bug Something isn't working

Comments

@timo92
Copy link

timo92 commented Jul 22, 2022

Are you certain it's a bug?

  • Yes, it looks like a bug

Are you using the latest version?

  • Yes, I'm using the latest version

Is there an existing issue for this?

  • 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:
@pgrzesik
Copy link
Contributor

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.

@timo92
Copy link
Author

timo92 commented Jul 25, 2022

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.

@pgrzesik
Copy link
Contributor

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 pgrzesik added bug Something isn't working and removed needs feedback labels Jul 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants