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

FetchError: request to https://oauth2.googleapis.com/token failed #3652

Open
broccolihighkicks opened this issue Aug 16, 2022 · 0 comments
Open
Assignees
Labels
api: compute Issues related to the Compute Engine API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@broccolihighkicks
Copy link

broccolihighkicks commented Aug 16, 2022

Environment details

  • OS: macOS
  • Node.js version: Node.js v17.5.0
  • npm version: 8.4.1
  • @google-cloud/compute version: "^3.3.0"

Steps to reproduce

  1. Do some combination of create/list/delete compute engine instances for a few minutes.
    Note: Seems more common when the event loop is blocked working for a few minutes.

I get this error occasionally:

/x/node_modules/node-fetch/lib/index.js:1491
			reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err));
			       ^

FetchError: request to https://oauth2.googleapis.com/token failed, reason: getaddrinfo ENOTFOUND oauth2.googleapis.com
    at ClientRequest.<anonymous> (/x/node_modules/node-fetch/lib/index.js:1491:11)
    at ClientRequest.emit (node:events:526:28)
    at TLSSocket.socketErrorListener (node:_http_client:442:9)
    at TLSSocket.emit (node:events:526:28)
    at emitErrorNT (node:internal/streams/destroy:164:8)
    at emitErrorCloseNT (node:internal/streams/destroy:129:3)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  type: 'system',
  errno: 'ENOTFOUND',
  code: 'ENOTFOUND',
  config: {
    method: 'POST',
    url: 'https://oauth2.googleapis.com/token',
    data: 'refresh_token=x&client_id=x&client_secret=x&grant_type=refresh_token',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
      'User-Agent': 'google-api-nodejs-client/8.0.2',
      'x-goog-api-client': 'gl-node/17.5.0 auth/8.0.2',
      Accept: 'application/json'
    },
    paramsSerializer: [Function: paramsSerializer],
    body: 'refresh_token=x&client_id=x&client_secret=x&grant_type=refresh_token',
    validateStatus: [Function: validateStatus],
    responseType: 'json'
  }
}
  • I am running Node.js on a Mac.
  • I think it is using gcloud/ADC (Application Default Credentials) as I am not setting a GOOGLE_APPLICATION_CREDENTIALS env var.
  • I also get an ECONNRESET error.
  • I have tried wrapping all the async Google code in a try/catch, but this errror is not caught and crashes the Node process. The stack traces do not link back to my application code so I am not sure what triggers it.

I am assuming that the Google Cloud library is doing a poll to refresh this token, but if that fails it will also crash the process?

@broccolihighkicks broccolihighkicks added priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Aug 16, 2022
@product-auto-label product-auto-label bot added the api: compute Issues related to the Compute Engine API. label Aug 16, 2022
@sofisl sofisl transferred this issue from googleapis/nodejs-compute Nov 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: compute Issues related to the Compute Engine API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

3 participants