[go: up one dir, main page]

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

Methods that perform a fetch should throw any socket errors directly (ECONNRESET) #5300

Open
ryanwilsonperkin opened this issue Apr 30, 2024 · 0 comments
Labels
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

@ryanwilsonperkin
Copy link

Related: #2254

Environment details

  • which product (packages/*): @google-cloud/storage
  • OS: Linux/MacOS
  • Node.js version: 20
  • npm version: 10.2.4
  • google-cloud-node version: 7.10.0

Steps to reproduce

When running multiple uploads in parallel, we frequently encounter ECONNRESET socket errors such as

FetchError: request to https://storage.googleapis.com/storage/v1/b/path-redacted failed, reason: write ECONNRESET
--
  | at ClientRequest.<anonymous> (/app/node_modules/.pnpm/node-fetch@2.7.0/node_modules/node-fetch/lib/index.js:1501:11)
  | at ClientRequest.emit (node:events:518:28)
  | at ClientRequest.emit (node:domain:488:12)
  | at TLSSocket.socketErrorListener (node:_http_client:495:9)
  | at TLSSocket.emit (node:events:518:28)
  | at TLSSocket.emit (node:domain:488:12)
  | at emitErrorNT (node:internal/streams/destroy:169:8)
  | at emitErrorCloseNT (node:internal/streams/destroy:128:3)
  | at processTicksAndRejections (node:internal/process/task_queues:82:21) {
  | type: 'system',
  | errno: 'ECONNRESET',
  | code: 'ECONNRESET'
  | }

These happen for us using the Bucket#upload method, and we would like to be able to catch the error and handle it appropriately, but the error is thrown in such a way that it can't be caught by a try/catch on Bucket#upload an instead needs to be captured at the process level by an event handler.

When GCS is instantiating the node-fetch client, the client should capture any FetchError and reject the promise with it.

@sofisl sofisl added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p2 Moderately-important priority. Fix may not be included in next release. labels May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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

2 participants