This repository was archived by the owner on Mar 3, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 394
This repository was archived by the owner on Mar 3, 2026. It is now read-only.
retryOptions.retryableErrorFn called with 200 ok for resumable upload #1851
Copy link
Copy link
Closed
Labels
api: storageIssues related to the googleapis/nodejs-storage API.Issues related to the googleapis/nodejs-storage API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: questionRequest for information or clarification. Not an issue.Request for information or clarification. Not an issue.
Description
Environment details
- OS: node14.18.2-alpine3.12 (docker)
- Node.js version: 14.18.2
- npm version: 6.14.15
@google-cloud/storageversion: 5.18.3
Steps to reproduce
retryOptions.retryableErrorFn is often called with a plain object containing code: 200.
const storage = new Storage({
retryOptions: {
autoRetry: true,
retryDelayMultiplier: 2,
totalTimeout: 600,
maxRetryDelay: 60,
maxRetries: 10,
idempotencyStrategy: IdempotencyStrategy.RetryAlways,
retryableErrorFn: (err) => {
console.log(err)
// !!
// err is often a plain object:
// { code: 200, message: 'OK', name: 'OK' }
return true
},
},
})
const cloudFile = storage.bucket('our-bucket').file('somename.zip')
const result = await cloudFile.save(buffer, {
// `resumable: true` seems to be the key to triggering this.
// We only set `resumable: true` with files > 10mb.
resumable: true,
gzip: true,
metadata: {
cacheControl: 'no-cache',
},
predefinedAcl: 'projectPrivate',
})If we ignore the 200s in retryableErrorFn, cloudFile.save ultimately succeeds, but it took a while for us to discover we could safely ignore them as we could only reproduce this in production. retryableErrorFn is called in the upload stream's error event, obviously extremely confusing that it's called with a code 200.
If we retry the 200s, it retries until it eventually fails with:
The offset is lower than the number of bytes written. The server has 0 bytes and while XXXX bytes has been uploaded - thus XXXX bytes are missing. Stopping as this could result in data loss. Initiate a new upload to continue.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
api: storageIssues related to the googleapis/nodejs-storage API.Issues related to the googleapis/nodejs-storage API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: questionRequest for information or clarification. Not an issue.Request for information or clarification. Not an issue.