serverless / compose

Orchestrate Serverless Framework in monorepos
https://serverless.com/framework/docs/guides/compose
MIT License
111 stars 15 forks source link

Error: spawn serverless ENOENT #164

Closed iamsurajdc closed 1 year ago

iamsurajdc commented 1 year ago

Are you certain it's a bug?

Are you using the latest version?

Is there an existing issue for this?

Issue description

serverless deploy throws spawn serverless ENOENT Getting the below error when trying to deploy client-service, although before that all services are getting deployed.

Error: spawn serverless ENOENT

Using the below versions for serverless and serverless compose

"@serverless/compose": "^1.3.0",
"serverless": "^3.22.0",

Service configuration (serverless-compose.yml) content

const serverlessCompose = {
  services: {
    "infra-test": {
      path: "infra-test",
    },
    "client-service": {
      path: "client-'service'",
      dependsOn: ["infra-test"],
    },
  },
};

module.exports = serverlessCompose;

Command name and used flags

serverless deploy --stage sbx

Command output

$ serverless deploy --stage sbx

Deploying to stage sbx
infra-test › waiting
client-service › waiting
infra-test › deploying
infra-test › Running "serverless deploy --stage sbx"
infra-test › Running "serverless" from node_modules
infra-test › Deploying infra-test to stage sbx (ap-south-1)
infra-test › Change set did not include any changes to be deployed. (3s)
infra-test › 3 deprecations found: run 'serverless doctor' for more details
infra-test › Running "serverless info --verbose --stage sbx"
infra-test › Running "serverless" from node_modules
infra-test › service: infra-test
infra-test › stage: sbx
infra-test › region: ap-south-1
infra-test › stack: infra-test-sbx
infra-test › 
infra-test › Stack Outputs:
infra-test ›   ServerlessDeploymentBucketName: infra-test-sbx-serverlessdeploymentbucket-yg91fd
infra-test › 3 deprecations found: run 'serverless doctor' for more details
infra-test › deployed
client-service › deploying
client-service › Running "serverless deploy --stage sbx"
client-service › error
client-service › spawn serverless ENOENT
client-service › Error: spawn serverless ENOENT
client-service ›     at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)
client-service ›     at onErrorNT (node:internal/child_process:476:16)
client-service ›     at processTicksAndRejections (node:internal/process/task_queues:82:21)
iamsurajdc commented 1 year ago

Apparently, Issue was

   "client-service": {
      path: "client-'service'",
      dependsOn: ["infra-test"],
    }

in path "client-'service'" there is a single inverted comma, which is a syntactical error causing this

The correct snippet as follows:

 "client-service": {
      path: "client-service",
      dependsOn: ["infra-test"],
    },