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

Can't log in to serverless with command #482

Closed
Risto-Stevcev opened this issue Mar 26, 2020 · 8 comments
Closed

Can't log in to serverless with command #482

Risto-Stevcev opened this issue Mar 26, 2020 · 8 comments
Labels
bug Something isn't working

Comments

@Risto-Stevcev
Copy link

Bug Report

Description

  1. What did you do?
    I created a new serverless project for NodeJS with AWS lambda. I initially skipped the step to add an account to see the dashboards. I added the auth for serverless to AWS and deployed, and it successfully shows up as a lambda in AWS.

Then I tried adding the account by running serverless again. I ran into this error:

  1. What happened?
You are not logged in or you do not have a Serverless account.

Serverless: Do you want to login or register? login
If your browser does not open automatically, please open it &  open the URL below to log in:
https://serverlessinc.auth0.com/authorize?audience=https%3A%2F%2Fserverlessinc.auth0.com%2Fuserinfo&response_type=code&client_id=YAHOG8papb1tkrLttNVoVOSs4YLOjrNj&redirect_uri=https%3A%2F%2Fdashboard.serverless.com%2Fcallback%3FtransactionId%3DnYs0LK8heFp88DBtXiCJ5&scope=openid%20email_verified%20email%20profile%20name%20offline_access
 
  Error --------------------------------------------------
 
  Error: spawn /home/risto/.serverless/bin/xdg-open ENOENT
      at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)
      at onErrorNT (internal/child_process.js:456:16)
      at processTicksAndRejections (internal/process/task_queues.js:80:21)
 
     For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
 
  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com
 
  Your Environment Information ---------------------------
     Operating System:          linux
     Node Version:              12.13.1
     Framework Version:         1.67.0 (standalone)
     Plugin Version:            3.5.0
     SDK Version:               2.3.0
     Components Version:        2.22.3

Note that xdg-open [some url] works fine if I run it normally and it opens my browser.

So I manually copied the link to the browser, logged in, and it just brought me back to
https://dashboard.serverless.com/tenants/risto/onboarding

So I click "serverless framework/existing project", and tells me to run serverless login, which ends up with the same thing as above so I'm just going in circles

  1. What should've happened?
    I think it should've opened the link, I log in, and then I'm logged in and it shows my project

  2. What's the content of your serverless.yml file?

service: avcado

org: risto
app: avcado

provider:
  name: aws
  runtime: nodejs12.x

functions:
  hello:
    handler: handler.hello
  1. What's the output you get when you use the SLS_DEBUG=* environment variable (e.g. SLS_DEBUG=* serverless deploy)
Serverless: Load command interactiveCli
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command config:tabcompletion
Serverless: Load command config:tabcompletion:install
Serverless: Load command config:tabcompletion:uninstall
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 upgrade
Serverless: Load command uninstall
Serverless: Load command login
Serverless: Load command logout
Serverless: Load command generate-event
Serverless: Load command test
Serverless: Load command dashboard
Serverless: Load command output
Serverless: Load command output:get
Serverless: Load command output:list
Serverless: Load command param
Serverless: Load command param:get
Serverless: Load command param:list
Serverless: Invoke login
Serverless: Logging you in via your default browser...
If your browser does not open automatically, please open it &  open the URL below to log in:
https://serverlessinc.auth0.com/authorize?audience=https%3A%2F%2Fserverlessinc.auth0.com%2Fuserinfo&response_type=code&client_id=YAHOG8papb1tkrLttNVoVOSs4YLOjrNj&redirect_uri=https%3A%2F%2Fdashboard.serverless.com%2Fcallback%3FtransactionId%3DMcfFLooC2numDdwg4XB2N&scope=openid%20email_verified%20email%20profile%20name%20offline_access
 
  Error --------------------------------------------------
 
  Error: spawn /home/risto/.serverless/bin/xdg-open ENOENT
      at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)
      at onErrorNT (internal/child_process.js:456:16)
      at processTicksAndRejections (internal/process/task_queues.js:80:21)
 
  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com
 
  Your Environment Information ---------------------------
     Operating System:          linux
     Node Version:              12.13.1
     Framework Version:         1.67.0 (standalone)
     Plugin Version:            3.5.0
     SDK Version:               2.3.0
     Components Version:        2.22.3
@Risto-Stevcev
Copy link
Author

UPDATE:
I had installed this using the CLI method:

curl -o- -L https://slss.io/install | bash

I didn't notice there was an npm binary. So I uninstalled serverless with serverless uninstall, and then I installed the npm version with yarn global add serverless. Everything worked with serverless login and the CLI said that I successfully logged in.

  • I deployed, the deployment shows up on the site.
  • I tried accessing the dashboard but it logged me out and said there was an error logging me in. After a few attempts I managed to log in again.
  • It still shows the onboarding page when I log in by default

@fernando-mc
Copy link

Hi @Risto-Stevcev, sorry that you're experiencing this. As a temporary workaround, you can create an access token in the dashboard and set it as SERVERLESS_ACCESS_KEY in your local environment. That might unblock you as we look into this. You can create one of these under the top right menu under "Person Access Keys".

@medikoo
Copy link
Contributor

medikoo commented Apr 17, 2020

Issue is result of following:

  • Login internally uses opn which on Linux may fallback to its in package bundled xdg-open
  • In standalone, the opn's xdg-open is not bundled and even it would be bundled it won't be accessible for child_process.spawn. Also path.join(__dirname, ...) are patched to point to path of standalone (hence in error above we see /home/risto/.serverless/bin/xdg-open ENOENT)
  • Open browser logic we use, is configured to mute any exceptions with which opn may result, so technically we should not observe crash here. Still there's a known bug in opn which anyway leaks spawn exceptions into the air (so they end as uncaught exceptions)

This would be fixed once we upgrade to opn v7, as we can see they've updated there to confirm on access to locally bundled xdg-open -> https://github.com/sindresorhus/open/blob/v7.0.3/index.js#L113-L122

Still on grounds of v1 we cannot upgrade without breaking support for Node.js v6.

Hopefully soon we'd be able to upgrade to v2, and then we'll ensure to use latest version of opn (open in this case)

@crisecheverria
Copy link

UPDATE:
I had installed this using the CLI method:

curl -o- -L https://slss.io/install | bash

I didn't notice there was an npm binary. So I uninstalled serverless with serverless uninstall, and then I installed the npm version with yarn global add serverless. Everything worked with serverless login and the CLI said that I successfully logged in.

  • I deployed, the deployment shows up on the site.
  • I tried accessing the dashboard but it logged me out and said there was an error logging me in. After a few attempts I managed to log in again.
  • It still shows the onboarding page when I log in by default

Worked for me after RE-installing serverless.
Also, I'm able to see the dashboard.

@medikoo medikoo transferred this issue from serverless/serverless Aug 27, 2020
medikoo added a commit that referenced this issue Aug 27, 2020
medikoo added a commit that referenced this issue Aug 27, 2020
medikoo added a commit that referenced this issue Aug 28, 2020
@medikoo
Copy link
Contributor

medikoo commented Aug 28, 2020

Fixed in #477

@medikoo medikoo closed this as completed Aug 28, 2020
@medikoo medikoo added the bug Something isn't working label Aug 28, 2020
medikoo added a commit that referenced this issue Aug 28, 2020
medikoo added a commit that referenced this issue Aug 28, 2020
@wichopy
Copy link

wichopy commented Dec 9, 2021

is logging into the web app not possible with v1 serverless cli? I am trying to deploy my own version of bundlewatch https://github.com/bundlewatch/service/blob/master/serverless.yml but with the serverless v1 cli I cant login, and with serverless v2 cli i can log in but its not compatible with their yaml.

@medikoo
Copy link
Contributor

medikoo commented Dec 9, 2021

@wichopy v1 is no longer supported. What blocks you from upgrading to v2?

@wichopy
Copy link

wichopy commented Dec 9, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants