Skip to content

k6 cloud login stack trailing / #5894

@ankur22

Description

@ankur22

Brief summary

k6 cloud login fails when the stack is provided with a /:

k6 cloud login

         /\      Grafana   /‾‾/  
    /\  /  \     |\  __   /  /   
   /  \/    \    | |/ /  /   ‾‾\ 
  /          \   |   (  |  (‾)  |
 / __________ \  |_|\_\  \_____/ 

Enter your token to authenticate with Grafana Cloud.
Please, consult the documentation for instructions on how to generate one:
https://grafana.com/docs/grafana-cloud/testing/k6/author-run/tokens-and-cli-authentication

  Token: 

Enter the stack where you want to run k6's commands by default.
You can enter a full URL (e.g. https://my-team.grafana.net) or just the slug (e.g. my-team):

  Stack: https://foobar.grafana.net/
ERRO[0010] Authentication failed as provided token or stack might not be valid. Learn more: https://grafana.com/docs/grafana-cloud/testing/k6/author-run/tokens-and-cli-authentication. Server error for details: (403/error) Stack not found or you don't have access: 'https://foobar.grafana.net/' 
exit status 255

If the trailing / is removed the login works:

k6 cloud login

         /\      Grafana   /‾‾/  
    /\  /  \     |\  __   /  /   
   /  \/    \    | |/ /  /   ‾‾\ 
  /          \   |   (  |  (‾)  |
 / __________ \  |_|\_\  \_____/ 

Enter your token to authenticate with Grafana Cloud.
Please, consult the documentation for instructions on how to generate one:
https://grafana.com/docs/grafana-cloud/testing/k6/author-run/tokens-and-cli-authentication

  Token: 

Enter the stack where you want to run k6's commands by default.
You can enter a full URL (e.g. https://my-team.grafana.net) or just the slug (e.g. my-team):

  Stack: https://foobar.grafana.net 

Logged in successfully, token and stack info saved in /Users/foobar/Library/Application Support/k6/config.json
  token: <redacted>
  stack-id: <redacted>
  stack-url: https://foobar.grafana.net
  default-project-id: <redacted>

k6 version

fb943a6

OS

NA

Docker version and image (if applicable)

No response

Steps to reproduce the problem

  1. k6 cloud login
  2. When asked for stack, provide it with the URL to your stack with a trailing /

Expected behaviour

It should work, maybe by cleaning up the URL

Actual behaviour

Fails

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions