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

serverless login throws SyntaxError: The URL's protocol must be... #11346

Open
4 tasks done
shukar1 opened this issue Aug 20, 2022 · 10 comments
Open
4 tasks done

serverless login throws SyntaxError: The URL's protocol must be... #11346

shukar1 opened this issue Aug 20, 2022 · 10 comments

Comments

@shukar1
Copy link

shukar1 commented Aug 20, 2022

Are you certain it's a bug?

  • Yes, it looks like a bug

Is the issue caused by a plugin?

  • It is not a plugin issue

Are you using the latest v3 release?

  • Yes, I'm using the latest v3 release

Is there an existing issue for this?

  • I have searched existing issues, it hasn't been reported yet

Issue description

serverless login throws and exception:

SyntaxError: The URL's protocol must be one of "ws:", "wss:", or "ws+unix:"

Service configuration (serverless.yml) content

N/A

Command name and used flags

serverless login

Command output

SyntaxError: The URL's protocol must be one of "ws:", "wss:", or "ws+unix:"
    at initAsClient (.../node_modules/ws/lib/websocket.js:693:17)
    at new WebSocket (.../node_modules/ws/lib/websocket.js:85:7)
    at ServerlessSDK.loginIdentity (.../node_modules/@serverless/platform-client/src/index.js:1066:16)
    at ServerlessSDK.login (.../node_modules/@serverless/platform-client/src/index.js:1139:70)
    at module.exports (.../node_modules/serverless/lib/commands/login/dashboard.js:13:64)
    at module.exports (.../node_modules/serverless/commands/login.js:43:55)
    at async .../node_modules/serverless/scripts/serverless.js:539:9

Environment information

Framework Core: 3.22.0 (local) 3.22.0 (global)
Plugin: 6.2.2
SDK: 4.3.2
@mnapoli
Copy link
Contributor

mnapoli commented Aug 22, 2022

Hi, I can't reproduce the problem. Could you provide the complete command output instead of just the error?

@shukar1
Copy link
Author

shukar1 commented Aug 23, 2022

It might have happened to me for copying a serverless.yml into an existing project.

initializing a new project using serverless init and then serverless login - worked seamlessly.

I already deleted that pre-existing project

Ty

@morficus
Copy link

Hello! 👋
I'm running into this exact same error when using the serveless login command

$  serverless login
Running "serverless" from node_modules
Logging into the Serverless Dashboard via the browser
Environment: darwin, node 18.12.1, framework 3.26.0 (local) 3.10.2v (global), plugin 6.2.2, SDK 4.3.2
Docs:        docs.serverless.com
Support:     forum.serverless.com
Bugs:        github.com/serverless/serverless/issues

Error:
Error:
SyntaxError: The URL's protocol must be one of "ws:", "wss:", or "ws+unix:"
    at initAsClient (<<path-to-project>>/node_modules/ws/lib/websocket.js:693:17)
    at new WebSocket (<<path-to-project>>/node_modules/ws/lib/websocket.js:85:7)
    at ServerlessSDK.loginIdentity (<<path-to-project>>/node_modules/@serverless/platform-client/src/index.js:1066:16)
    at ServerlessSDK.login (<<path-to-project>>/node_modules/@serverless/platform-client/src/index.js:1139:70)
    at module.exports (<<path-to-project>>/node_modules/serverless/lib/commands/login/dashboard.js:13:64)
    at module.exports (<<path-to-project>>/node_modules/serverless/commands/login.js:36:55)
    at async <<path-to-project>>/node_modules/serverless/scripts/serverless.js:556:9

@RobbyKetchell
Copy link

Hi, I had a similar issue. Try removing node_modules, deleting package-lock.json and running npm cache clean --force. Then reinstall your dependencies with npm install and try again.

@burslf
Copy link

burslf commented Feb 11, 2023

@RobbyKetchell this didn't work for me, that is weird because it was working before, and on my other projects when i run the command it works.

@codedge
Copy link

codedge commented Feb 17, 2023

I get this error too.

Environment: darwin
node 19.6.0
framework 3.27.0 (local) 3.27.0v (global)
plugin 6.2.3
SDK 4.3.2

serverless login
Running "serverless" from node_modules
(node:48475) NOTE: The AWS SDK for JavaScript (v2) will be put into maintenance mode in 2023.

Please migrate your code to use AWS SDK for JavaScript (v3).
For more information, check the migration guide at https://a.co/7PzMCcy
(Use `node --trace-warnings ...` to show where the warning was created)
Logging into the Serverless Dashboard via the browser
Environment: darwin, node 19.6.0, framework 3.27.0 (local) 3.27.0v (global), plugin 6.2.3, SDK 4.3.2
Docs:        docs.serverless.com
Support:     forum.serverless.com
Bugs:        github.com/serverless/serverless/issues

Error:
SyntaxError: The URL's protocol must be one of "ws:", "wss:", or "ws+unix:"
    at initAsClient (/Users/holger/node_modules/ws/lib/websocket.js:695:17)
    at new WebSocket (/Users/holger/node_modules/ws/lib/websocket.js:85:7)
    at ServerlessSDK.loginIdentity (/Users/holger/node_modules/@serverless/platform-client/src/index.js:1066:16)
    at ServerlessSDK.login (/Users/holger/node_modules/@serverless/platform-client/src/index.js:1139:70)
    at module.exports (/Users/holger/node_modules/serverless/lib/commands/login/dashboard.js:13:64)
    at module.exports (/Users/holger/node_modules/serverless/commands/login.js:36:55)
    at async /Users/holger/node_modules/serverless/scripts/serverless.js:556:9

Even deleting the node_modules folder and re-installing did not help.

No idea how to proceed deploying.

@FloUz-ai
Copy link

FloUz-ai commented Feb 25, 2023

Exact same error here, the @RobbyKetchell solution worked for me thx!

@Jacesheck
Copy link

Jacesheck commented Mar 7, 2023

Had the same problem. Deleting my entire personal git project on my computer and cloning from git worked for me. I was on the careful side and ran serverless login directly after cloning.

@barbados-clemens
Copy link

ran into this as well. it looks like the ws dep is using v8 in my repo but in a different sample repo that works it's using ws@v7

using package.json overrides
I was able to get it working.

"overrides": {
  "ws": "7.4.4"
}

npm ls ws showing two different versions

@safa-kajabi
Copy link

Could someone please assist me with this? I'm encountering the same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants