-
Notifications
You must be signed in to change notification settings - Fork 377
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
Unhelpful error message when credentials misssing #620
Comments
👋 so I'm finally getting to look at this one. When I try it, I am getting this:
I found that doc to be much more helpful :) Can you share the steps you're using to get that error? It's entirely possible this is something we accidentally fixed. |
I don't remember the precise steps. I tried reproducing from scratch in the way I expect I would have done originally:
This seems different / more reasonable. Let me see if I can reproduce some other way. |
Here's a repro, in a new dir, add require('@google-cloud/debug-agent').start({
allowExpressions: true,
projectId: 'ofrobots-test-19' // <-- change this to your own project
});
setTimeout(() => {}, 10000); Run ❯ node index.js
@google-cloud/debug-agent Failed to re-register debuggee ofrobots-test-19: Error: Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.
@google-cloud/debug-agent Failed to re-register debuggee ofrobots-test-19: Error: Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.
@google-cloud/debug-agent Failed to re-register debuggee ofrobots-test-19: Error: Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project. |
Ok - I finally tracked this one down. It's a bug on nodejs-common: Even if auth fails, it still decides "hell, maybe we won't need a token!" and sends the request to the backend anyway. The error message we're getting is part of the body from the 401 response that comes back from the debug API itself. I can't imagine why we wouldn't fail in this scenario with the original call stack. Uh, @stephenplusplus ? |
Original PR: googleapis/google-cloud-node#2712 Failing with the original call stack would make sense to me, too. |
Just in case I misunderstood what you meant by fail, the first error message would be more helpful, but I believe we still need to attempt the API request, as they don't all require authentication. It might not be so easy, though, to define the condition that we want to ignore the API failure message and use the auth lib's. Maybe only when it's a 401? |
If the API endpoint requires credentials, and we can't acquire them - the original callstack would be very nice here. The 401 approach is fine. I am curious though ... what's the use case for this one? I'm sure we had a good reason, it's just not called out in the PR. |
I believe Storage.File#download, but there might be others by now. My bad for not leaving a better trail in that PR. |
I was trying to use a Node.js client library (any, doesn't matter) in a Node.js express server. I started the app without providing credentials. I expected an error, but the error I got was less than useful.
Problems:
The text was updated successfully, but these errors were encountered: