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

Some command-names are incompatible with serverless-compose #382

Open
jimmyorpheus opened this issue Jan 25, 2024 · 0 comments
Open

Some command-names are incompatible with serverless-compose #382

jimmyorpheus opened this issue Jan 25, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@jimmyorpheus
Copy link

jimmyorpheus commented Jan 25, 2024

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.

❯ 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,

How to Reproduce

serverless-compose.yml

services:
  slstry:
    path: slstry

serverless.yml

service: slstry
frameworkVersion: '3'

provider:
  name: aws
  runtime: nodejs18.x
  region: eu-central-1
  stage: dev

package:
  individually: true
  
functions:
  tryit:
    handler: index.handler

plugins:
  - serverless-lift

constructs:
  slstryQueue:
    type: queue
    delay: 5
    maxConcurrency: 10
    maxRetries: 2
    worker:
      handler: worker.work
      timeout: 60

Execute command within compose folder:
sls "slstryQueue:failed" --service=slstry --verbose

Additional Information

There is a related issue at the serverless-compose repo
serverless/compose#186

@jimmyorpheus jimmyorpheus added the bug Something isn't working label Jan 25, 2024
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

1 participant