When using serverless-compose, serverless commands e.g. sls deploy list --service=slstry need to be executed within the compose folder (the folder that includes the individual service folders and the serverless-compose.yml file) instead of the service folder itself. The --service argument tells serverless-compose which service the command should be applied to.
This works fine for most commands, also some serverless-lift commands like:
sls lift eject --service=slstry --verbose
But execution fails when trying to execute commands that include colons in their naming, since serverless-compose seems to replace those colons with spaces.
❯ sls "slstryQueue:failed" --service=slstry --verbose
serverless › Invoking "slstryQueue:failed" on service "slstry"
slstry › Running "serverless slstryQueue failed --verbose --stage dev"
Running "serverless" from node_modules
Environment: darwin, node 18.16.1, framework 3.38.0 (local) 3.38.0v (global), plugin 7.2.0, SDK 4.5.1
Docs: docs.serverless.com
Support: forum.serverless.com
Bugs: github.com/serverless/serverless/issues
Error:
Serverless command "slstryQueue failed" not found. Did you mean "slstryQueue:failed"? Run "serverless help" for a list of all available commands.
Error:
Now one might suggest to avoid serverless-compose by executing the command directly within the folder of the specific service. But that is not always possible, because when using serverless-compose your serverless.yml files might have references to shared outputs of other services, and those might cause an execution error like:
...make sure to run commands via Compose so that all parameters can be resolved,
Description
When using serverless-compose, serverless commands
e.g. sls deploy list --service=slstry
need to be executed within the compose folder (the folder that includes the individual service folders and the serverless-compose.yml file) instead of the service folder itself. The --service argument tells serverless-compose which service the command should be applied to.This works fine for most commands, also some serverless-lift commands like:
sls lift eject --service=slstry --verbose
But execution fails when trying to execute commands that include colons in their naming, since serverless-compose seems to replace those colons with spaces.
Now one might suggest to avoid serverless-compose by executing the command directly within the folder of the specific service. But that is not always possible, because when using serverless-compose your serverless.yml files might have references to shared outputs of other services, and those might cause an execution error like:
...make sure to run commands via Compose so that all parameters can be resolved,
How to Reproduce
serverless-compose.yml
serverless.yml
Execute command within compose folder:
sls "slstryQueue:failed" --service=slstry --verbose
Additional Information
There is a related issue at the serverless-compose repo https://github.com/serverless/compose/issues/186