serverless / compose

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

BUG spawn serverless ENOENT #94

Closed AxopenLyon closed 2 years ago

AxopenLyon commented 2 years ago

I've been waiting for this kind of feature, thanks for it ! I just would like to report a bug which I've found a workaround, but maybe you could find a real fix.

I'm on a Windows 11, and I've installed serverlessand @serverless/compose using npm -g.

Everything works fine on each single service, but when I try to deploy using compose, I got the following error :

$ serverless deploy
Deploying to stage dev
auction-service › error › 0s
spawn serverless ENOENT
auth-service › error › 0s
spawn serverless ENOENT
notification-service › error › 0s
spawn serverless ENOENT

My compose file looks like this :


Deploying to stage dev
auction-service › waiting
auth-service › waiting
notification-service › waiting
auction-service › deploying
auth-service › deploying
notification-service › deploying
auction-service › Running "serverless deploy --stage dev"
auth-service › Running "serverless deploy --stage dev"
notification-service › Running "serverless deploy --stage dev"
auction-service › error
auction-service › spawn serverless ENOENT
auction-service › Error: spawn serverless ENOENT
auction-service ›     at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
auction-service ›     at onErrorNT (node:internal/child_process:477:16)
auction-service ›     at processTicksAndRejections (node:internal/process/task_queues:83:21)
auth-service › error
auth-service › spawn serverless ENOENT
auth-service › Error: spawn serverless ENOENT
auth-service ›     at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
auth-service ›     at onErrorNT (node:internal/child_process:477:16)
auth-service ›     at processTicksAndRejections (node:internal/process/task_queues:83:21)
notification-service › error
notification-service › spawn serverless ENOENT
notification-service › Error: spawn serverless ENOENT
notification-service ›     at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
notification-service ›     at onErrorNT (node:internal/child_process:477:16)
notification-service ›     at processTicksAndRejections (node:internal/process/task_queues:83:21)

My workaround was to install serverless using choco in addition to npm -g Removing serverless in npm -g to only use choco serverless is not working neither, I really need to have npm -g and choco serverless.

Hope you guys can find a solution, either way keep up with the great work, this package is amazing !

pgrzesik commented 2 years ago

Hello @AxopenLyon - thanks a lot for reporting and sorry you've run into trouble. That is quite surprising, as I can see that you're running serverless without any issues in your terminal, correct? I will investigate if we can find the reason for that happening on Windows machines.

In addition, could you please share the output of sls --version?

Thanks in advance 🙇

AxopenLyon commented 2 years ago

Correct, I can use serverless without any issue, I've been deploying my services with no problem before trying to use serverless-compose.

$ sls -v
Framework Core: 3.15.0 (standalone)
Plugin: 6.2.2
SDK: 4.3.2
$ npm list -g
C:\Program Files\nodejs -> .\
+-- @serverless/compose@1.0.0
+-- madge@5.0.1
+-- npm@8.5.1
+-- serverless@3.15.0
`-- yarn@1.22.17

Thanks for your help, good luck !

chkrause commented 2 years ago

I run into exactly the same problem, when deploying the services separately it works fine.

 deploying
 Running "serverless deploy --stage dev"
 error
 spawn serverless ENOENT
 Error: spawn serverless ENOENT
     at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
     at onErrorNT (node:internal/child_process:477:16)
     at processTicksAndRejections (node:internal/process/task_queues:83:21)
serverless -v
Framework Core: 3.15.0
Plugin: 6.2.2
SDK: 4.3.2
npm list -g
├── @aws-amplify/cli@7.6.5
├── newman@5.3.1
├── npm@8.0.0
├── serverless@3.15.0
└── yarn@1.22.15
pgrzesik commented 2 years ago

Hello @chkrause - thanks for reporting - are you also on Windows?

chkrause commented 2 years ago

Hello @chkrause - thanks for reporting - are you also on Windows?

yes, I'm on windows.

abubakrsiddq commented 2 years ago

I am also facing similar issue on windows

stephenbawks commented 2 years ago

Glad to see I am not the only one. I had serverless installed via scoop and uninstalled it from there and installed it globally and still the same thing as well for me.

pgrzesik commented 2 years ago

Thanks everyone for your patience, the fix will be published with the new version that will go out either later today or tomorrow

pgrzesik commented 2 years ago

Hey everyone, fix has been released with v1.0.2 of Compose - please let me know if that fixes your problems

suwat-netprom commented 2 years ago

error spawn ENOTDIR

# serverless-compose.yml

services:
  service-a:
    path: serverless.yml
OS: Mac
Framework Core: 3.15.2 (local)
Plugin: 6.2.2
SDK: 4.3.2
npm list --depth=0
├── @serverless/compose@1.0.2
├── serverless@3.15.2
├── serverless-deployment-bucket@1.5.2
├── serverless-domain-manager@6.0.3
├── serverless-plugin-datadog@5.0.0
├── serverless-prune-plugin@2.0.1
├── serverless-python-requirements@5.4.0
└── serverless-wsgi@3.0.0
sls deploy --service=service-a

✖  service-a › error › 0s
spawn ENOTDIR

my structure

image

.serverless/compose.log

image
pgrzesik commented 2 years ago

Hello @suwat-netprom - in your case the problem is different - path should point to a directory that contains your project with serverless.yml, not to the serverless.yml itself.

suwat-netprom commented 2 years ago

Hello @pgrzesik, I confused, thank you explained me.

pgrzesik commented 2 years ago

Happy I could help @suwat-netprom 🎉

chkrause commented 2 years ago

Looks good now - Thanks for this quick fix. Unfortunatly I can't pass param to the serverless compose. serverless deploy --stage del --param="AccountIdZendesk=xxxxxxx"

Cannot resolve variable at "custom.AccountIdZendesk": The param "AccountIdZendesk" cannot be resolved from CLI options or stage params. If you are using Serverless Framework Compose, make sure to run commands via Compose so that all parameters can be resolved

The "--param" option is not supported (yet) in Serverless Framework Compose

mnapoli commented 2 years ago

@chkrause indeed --param is not supported in Compose. We could add that parameter, but let's try to understand your use case first.

Could you open a separate issue though? That way we don't ping those involved in the original issue which was about Windows support.