serverless / serverless/serverless

Failure to run `sls login`

Open
#6,932 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug cat/dashboard
Dominant language
JavaScript
Stars
46.9k
Forks
5.7k
Avg merge
10h 7m
Merged PRs (30d)
57

Description

Bug Report

Description

  1. What did you do? I am trying to use serverless login on an existing serverless.yml configuration to add existing functions to the serverless dashboard
  2. What happened? I received the following error:
Erics-MacBook-Pro-2:clearview-serverless eric$ ./node_modules/.bin/serverless login --stage dev
Serverless: Logging you in via your default browser...

/Users/eric/repos/clearview-serverless/node_modules/ws/lib/WebSocket.js:719
      error = new Error('unexpected server response (' + res.statusCode + ')');
              ^
Error: unexpected server response (302)
    at ClientRequest.response (/Users/eric/repos/clearview-serverless/node_modules/ws/lib/WebSocket.js:719:15)
    at Object.onceWrapper (events.js:299:26)
    at ClientRequest.emit (events.js:209:13)
    at ClientRequest.EventEmitter.emit (domain.js:476:20)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:583:27)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:115:17)
    at TLSSocket.socketOnData (_http_client.js:456:22)
    at TLSSocket.emit (events.js:209:13)
    at TLSSocket.EventEmitter.emit (domain.js:476:20)
    at addChunk (_stream_readable.js:305:12)
    at readableAddChunk (_stream_readable.js:286:11)
    at TLSSocket.Readable.push (_stream_readable.js:220:10)
    at TLSWrap.onStreamRead (internal/stream_base_commons.js:182:23)
  1. What should've happened? Based on the documentation, a browser session should have opened, prompting me to login.
  2. What's the content of your serverless.yml file? Honestly it's pretty large - we have around 40 functions deployed through this config. Please tell me what pertinent sections you'd need to help resolve this.
  3. What's the output you get when you use the SLS_DEBUG=* environment variable (e.g. SLS_DEBUG=* serverless deploy)
Erics-MacBook-Pro-2:clearview-serverless eric$ SLS_DEBUG=* ./node_modules/.bin/serverless login --stage dev
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command create
Serverless: Load command install
Serverless: Load command package
Serverless: Load command deploy
Serverless: Load command deploy:function
Serverless: Load command deploy:list
Serverless: Load command deploy:list:functions
Serverless: Load command invoke
Serverless: Load command invoke:local
Serverless: Load command info
Serverless: Load command logs
Serverless: Load command metrics
Serverless: Load command print
Serverless: Load command remove
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command slstats
Serverless: Load command plugin
Serverless: Load command plugin
Serverless: Load command plugin:install
Serverless: Load command plugin
Serverless: Load command plugin:uninstall
Serverless: Load command plugin
Serverless: Load command plugin:list
Serverless: Load command plugin
Serverless: Load command plugin:search
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command login
Serverless: Load command logout
Serverless: Load command generate-event
Serverless: Load command test
Serverless: Load command dashboard
Serverless: Invoke login
Serverless: Logging you in via your default browser...

/Users/eric/repos/clearview-serverless/node_modules/ws/lib/WebSocket.js:719
      error = new Error('unexpected server response (' + res.statusCode + ')');
              ^
Error: unexpected server response (302)
    at ClientRequest.response (/Users/eric/repos/clearview-serverless/node_modules/ws/lib/WebSocket.js:719:15)
    at Object.onceWrapper (events.js:299:26)
    at ClientRequest.emit (events.js:209:13)
    at ClientRequest.EventEmitter.emit (domain.js:476:20)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:583:27)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:115:17)
    at TLSSocket.socketOnData (_http_client.js:456:22)
    at TLSSocket.emit (events.js:209:13)
    at TLSSocket.EventEmitter.emit (domain.js:476:20)
    at addChunk (_stream_readable.js:305:12)
    at readableAddChunk (_stream_readable.js:286:11)
    at TLSSocket.Readable.push (_stream_readable.js:220:10)
    at TLSWrap.onStreamRead (internal/stream_base_commons.js:182:23)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce serverless login --stage dev with the reported SLS_DEBUG=* output, then trace the login command and the node_modules/ws/lib/WebSocket.js stack frame to understand why the 302 response fails. Done means the command opens the browser and reaches the documented login flow without this error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
authentication, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.