serverless-vscode icon indicating copy to clipboard operation
serverless-vscode copied to clipboard

Support globally installed serverless

Open HyperBrain opened this issue 7 years ago • 13 comments

The current version only supports locally installed per project serverless instances. It should support global serverless installations too.

HyperBrain avatar Dec 26 '17 21:12 HyperBrain

Does "serverless.useGlobal": true, work? It is not working for me.

fatangare avatar Mar 20 '18 13:03 fatangare

Hi @fatangare, thanks for the question 👍 . This is not implemented yet (this issue is the feature request).

HyperBrain avatar Mar 20 '18 13:03 HyperBrain

ah...it doesn't work for me either. It would be great to have this implemented.

serverlesspolska avatar Jul 04 '18 13:07 serverlesspolska

@panzupa I already implemented the feature, but it is still in PR #21 but not yet merged and released. Would you mind to test if it works for you, if I attach a temporary vsix package here, that you can install using "install extension from file"? If my fix is ok, I would release it asap.

HyperBrain avatar Jul 04 '18 17:07 HyperBrain

@HyperBrain Sure, no problem. I will gladly test it :-)

serverlesspolska avatar Jul 09 '18 07:07 serverlesspolska

@panzupa Here you go. Please add your feedback to this issue ;-) And thank you

serverless-vscode-1.1.0-alpha.vsix.zip

Oh. GitHub only supports ZIP files for upload, so please extract it locally and install the vsix as extension.

HyperBrain avatar Jul 09 '18 20:07 HyperBrain

I get:

Serverless: spawn serverless ENOENT

I tried to find more logs but I could. Please tell me where I should look.

Also, would be nice if plugin would ignore the region if one is already defined in serverless.yml

Running "serverless deploy function --function=fetch --region=eu-central-1 --stage=dev"

serverlesspolska avatar Jul 10 '18 15:07 serverlesspolska

Ok. The error you get is caused, because the extension cannot find the "serverless" executable in your path. Maybe that approach is wrong and it should use npx serverless to execute it in the current global node context. I will provide a new version for testing.

Regarding the feature idea: Nice catch. Maybe an option useRegionFromServerlessYaml could enable this?

HyperBrain avatar Jul 10 '18 18:07 HyperBrain

Regarding the feature idea: Nice catch. Maybe an option useRegionFromServerlessYaml could enable this?

If you're asking me, then please consider such case. Someone who already has a serverless project is installing your plugin. And suddenly it deploys to the other region then one defined in serverless.yml Personally, I think it's a bad approach. I would stay with the existing setting defaultRegion but set it to be empty. Your plugin seeing empty value should not add --region parameter at all. If someone wants to setup it, he can put something in the configuration.

serverlesspolska avatar Jul 11 '18 10:07 serverlesspolska

Sounds reasonable. I will create a new GitHub issue and provide a fix (should be trivial)

HyperBrain avatar Jul 11 '18 18:07 HyperBrain

Thanks @HyperBrain .

Ok. The error you get is caused, because the extension cannot find the "serverless" executable in your path. Maybe that approach is wrong and it should use npx serverless to execute it in the current global node context. I will provide a new version for testing

I don't use npx. BTW I'm testing this on Windows10 and I have serverless in my PATH.

serverlesspolska avatar Jul 12 '18 09:07 serverlesspolska

I believe npx ( now bundled with node ) solves for both cases. It first tries local node modules, the what's on your path, the finally installs when not available

softprops avatar Nov 15 '18 14:11 softprops

@HyperBrain any news about this new feature?

JaderCM avatar Apr 18 '20 18:04 JaderCM