-
Notifications
You must be signed in to change notification settings - Fork 856
fix: improve error message when CF API responds with an error #1122
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
fix: improve error message when CF API responds with an error #1122
Conversation
🦋 Changeset detectedLatest commit: 5b67d2d The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
A wrangler prerelease is available for testing. You can install this latest build in your project with: npm install --save-dev https://prerelease-registry.developers.workers.dev/runs/2392812815/npm-package-wrangler-1122 You can reference the automatically updated head of this PR with: npm install --save-dev https://prerelease-registry.developers.workers.dev/prs/1122/npm-package-wrangler-1122 Or you can use npx https://prerelease-registry.developers.workers.dev/runs/2392812815/npm-package-wrangler-1122 dev path/to/script.js |
For example if you have an invalid CF_API_TOKEN and try running `wrangler whoami` you now get the additional `6111` error information: ``` ✘ [ERROR] A request to the Cloudflare API (/user) failed. Invalid request headers [code: 6003] - Invalid format for Authorization header [code: 6111] ```
fe48ac6
to
5b67d2d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need more information for sleuthing these routes issues.
@@ -2754,7 +2754,7 @@ export async function main(argv: string[]): Promise<void> { | |||
e.notes.push({ | |||
text: "\nIf you think this is a bug, please open an issue at: https://github.com/cloudflare/wrangler2/issues/new", | |||
}); | |||
logger.error(formatMessage(e)); | |||
logger.log(formatMessage(e)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using .log()
here because the message already has an ERROR
prefix, so we don't want .error()
to add it again.
I find the current message confusing. The response is not bad it is a valid response saying that the request failed.