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

"cannot decode" error for all commands #207

Closed
cdjames opened this issue Jan 23, 2024 · 14 comments
Closed

"cannot decode" error for all commands #207

cdjames opened this issue Jan 23, 2024 · 14 comments

Comments

@cdjames
Copy link

cdjames commented Jan 23, 2024

All commands are failing with error "cannot decode response with unknown content type". Installed with brew install axiom

~ % axiom stream clavis-demo
! Organization ID is set using "AXIOM_ORG_ID"!
! Token is set using "AXIOM_TOKEN"!
! URL is set using "AXIOM_URL"!
Error: cannot decode response with unknown content type
~ % axiom auth status
! Organization ID is set using "AXIOM_ORG_ID"!
! Token is set using "AXIOM_TOKEN"!
! URL is set using "AXIOM_URL"!
➜ cloud
    ✖ cannot decode response with unknown content type

~/.zprofile:

export AXIOM_TOKEN="{redacted}"
export AXIOM_URL="https://app.axiom.co"
export AXIOM_ORG_ID="clavis-vsr2"
export AXIOM_DEPLOYMENT="cloud"

Shell: zsh
OS: macOS 12.7.2
Go version: go1.21.6 darwin/arm64
Brew version: 4.2.5
Axiom CLI version: 0.12.0 (revision: c70256c)

@lukasmalkmus
Copy link
Collaborator

Hi!

AXIOM_URL should point to our API, e.g. api.axiom.co instead of app.axiom.co.

Can you double check and report back here?

Cheers!

@cdjames
Copy link
Author

cdjames commented Jan 24, 2024

Hi!

AXIOM_URL should point to our API, e.g. api.axiom.co instead of app.axiom.co.

Can you double check and report back here?

Cheers!

Thanks for the tip, but unfortunately changing the URL gives the same result:
image

By the way, this is where I got the original URL.
image

@lukasmalkmus
Copy link
Collaborator

Thanks for the tip, but unfortunately changing the URL gives the same result:

That is interesting. I just re-ran a couple of tests for our API and that worked flawlessly. I'll investigate further...

By the way, this is where I got the original URL.

Duh! Thanks for letting us know! /cc @thecraftman Can you update our docs?

@cdjames Could you back up any config files or env vars and start from a blank state? How does running axiom auth login work for you?

@cdjames
Copy link
Author

cdjames commented Jan 24, 2024

@cdjames Could you back up any config files or env vars and start from a blank state? How does running axiom auth login work for you?

I'm able to run commands after I manually login using axiom auth login. However, I was hoping to avoid that since it's annoying to check my email to log in.
image

I think I figured it out; after I added the "active_deployment" line to my .axiom.toml file (based on the file created when axiom auth login was run, I was able to connect without a manual login. I think that might be something that's missing from the online documentation.

active_deployment = "axiom"

[deployments]

  [deployments.axiom]
    url = "https://api.axiom.co/"
    token = "xapt-XXXX"
    org_id = "clavis-vsr2"

@lukasmalkmus
Copy link
Collaborator

Remember you only need to be logged in once as the credentials are persisted in ~/.axiom.toml. But if you prefer to use environment variables, that is totally fine, too.

I think you stumbled across a bug here: If CLI is explicitly configured via the environment, the active_deployment should be ignored. The active_deployment is only there to persist the chosen environment/deployment and in most cases there is only one.

I'll leave this issue open as there are definitely some takeaways from this.

@thecraftman
Copy link
Contributor

thanks @cdjames i will update the docs and get this issue fixed.

@lukasmalkmus
Copy link
Collaborator

@cdjames I just double checked some of your reports and I wonder: It sounds like you had a ~/.axiom.toml present and environment variables? Ideally, you get rid of the config file if you don't plan on utilising that. If the env vars are present, it uses those. That should work for you without needing to wait of a fix. Also no need to set AXIOM_DEPLOYMENT.

I'll make sure docs get updated.

@lukasmalkmus
Copy link
Collaborator

@thecraftman Do you think we should get rid of the Sessions section? https://axiom.co/docs/reference/cli#session-support. I think it is a bit confusing. Most people won't use more than one deployment. Switching between orgs is possible via axiom auth switch-org or just setting AXIOM_ORG_ID.

We should probably highlight that a good starting point is logging in via CLI (axiom auth login or just running axiom when there is no config present) OR explicitly configuring via the environment, with credentials taken from the Profile page on the App. And in that later case also hint at the correct API url.

IMHO, the config file shouldn't be documented explicitly as it isn't intended to be edited manually for nearly all use cases.

@thecraftman
Copy link
Contributor

thecraftman commented Jan 26, 2024

@lukasmalkmus yeah awesome we need to specify that in the docs, and when to work with the active deployments per session support specifying axiom auth login and axiom commands. If the user has multiple environments we need to add how they can configure that as well using the API url

@thecraftman
Copy link
Contributor

thanks @cdjames a fix for this is on the way.

@cdjames
Copy link
Author

cdjames commented Jan 28, 2024

Ideally, you get rid of the config file if you don't plan on utilising that. If the env vars are present, it uses those.

@lukasmalkmus This is what I see if I get rid of the deployment file and try a command
image

Then if I replace the deployment file, the command works:
image

The token is the same in both cases.

@lukasmalkmus
Copy link
Collaborator

@cdjames Ah I see. Should have been more specific: You should be able to run all other commands, e.g. axiom stream, axiom ingest, everything under the axion dataset command without a problem.

axiom auth is indeed special as it operates directly on the configuration file, not caring about the env setup.

@thecraftman
Copy link
Contributor

@cdjames thanks the documentation for this has been updated here: https://axiom.co/docs/reference/cli

@lukasmalkmus
Copy link
Collaborator

lukasmalkmus commented Jan 30, 2024

Feel free to re-open or add a new issue if you have more questions, as the original cannot decode error was caused by setting the wrong API url. We improved the documentation on that.

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

No branches or pull requests

3 participants