Environment details
- OS: node14.18.2-alpine3.12 (docker)
- Node.js version: 14.18.2
- npm version: 6.14.15
@google-cloud/storage version: 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.
Environment details
@google-cloud/storageversion: 5.18.3Steps to reproduce
retryOptions.retryableErrorFnis often called with a plain object containingcode: 200.If we ignore the
200s inretryableErrorFn,cloudFile.saveultimately succeeds, but it took a while for us to discover we could safely ignore them as we could only reproduce this in production.retryableErrorFnis called in the upload stream'serrorevent, obviously extremely confusing that it's called with a code 200.If we retry the
200s, it retries until it eventually fails with: