CircleCI-Public / circleci-cli

Use CircleCI from the command line
https://circleci-public.github.io/circleci-cli/
MIT License
407 stars 232 forks source link

invalid character 'I' looking for beginning of value #965

Closed max-elastics closed 10 months ago

max-elastics commented 1 year ago

Meta:

CircleCI CLI Version: circleci-cli_0.1.22770_linux_amd64

Operating System: Ubuntu 20.04 LTS

CircleCI CLI Diagnostic: Tool won't run

Current behavior:

/tools/oss/Ubuntu/20.04/circleci/circleci-cli_0.1.27054_linux_amd64/circleci config validate
Error: config compilation request returned an error: invalid character 'I' looking for beginning of value

Expected behavior:

/tools/oss/Ubuntu/20.04/circleci/circleci-cli_0.1.22770_linux_amd64/circleci config validate
Config file at .circleci/config.yml is valid.

When did this begin / Was this previously working?: Moving from 0.1.22770 to 0.1.27054 broke something

Additional Information: none

willm commented 1 year ago

I'm also seeing this on mac os since the upgrade

fszymanski-blvd commented 1 year ago

Also having issues on mac os with this update

abdelDriowya commented 1 year ago

@max-elastics thanks for reporting this. And thanks @willm @fszymanski-blvd for confirming the issue Could you please try the same command by adding a token in the end circleci config validate --token YOUR_CIRCLECI_TOKEN

fszymanski-blvd commented 1 year ago

Could you please try the same command by adding a token in the end circleci config validate --token YOUR_CIRCLECI_TOKEN

I generated a new token and tested and this seems to work. It's odd that it worked immediately before upgrading without passing the token.

fszymanski-blvd commented 1 year ago

Continuing the test, it looks like I had a token set in the cli.yml but it must have been either invalidated or the format of the token changed. The new token looked different and after re-running circleci setup using the new token the command works fine.

abdelDriowya commented 1 year ago

@fszymanski-blvd thanks for your answer

you can check if your token is valid by doing a GET request to https://circleci.com/api/v2/me with a Circle-Token header containing your token doc : https://circleci.com/docs/api/v2/index.html#operation/getCurrentUser

MrSwitch commented 1 year ago

@abdelDriowya before now i've been using the cli's function circleci config validate and dont believe i've ever set a token or run circleci setup. When i go to view my "Personal API Tokens" it is empty.

Note: I do have a token defined in ~/.circleci/cli.yml but dont believe i ever set it up, and suspect this is some kind of default??? 🤷

fbacchella commented 1 year ago

curl -v -o /dev/null -H 'Circle-Token: XXXX' https://circleci.com/docs/api/v2/index.html#operation/getCurrentUse works, I got a 200, but I add to remove the token from cli.yml to get circleci config validate.

My cli version:

$ circleci version
0.1.28434+5523658 (homebrew)
williamgurzoni commented 1 year ago

I had the same issue and I solved by creating a new token and updating via circleci setup.

abdelDriowya commented 1 year ago

@MrSwitch we don't have any default value. you can verify it's your token by doing a GET request to https://circleci.com/api/v2/me with a Circle-Token header containing your token

abdelDriowya commented 1 year ago

@MrSwitch it's possible that your token was revoked during the security incident if you setup it before

fbacchella commented 1 year ago

The cli should not return a cryptic error message but an access denied if it’s linked.

abdelDriowya commented 10 months ago

passing the token circleci config validate --token YOUR_CIRCLECI_TOKEN or configuring the token using circleci setup solves this issues, I create a jira ticket to create more explicit error message. I'll Close this issue, please open an issue if you still have this problem.