Skip to content

Spurious precondition failures caused by ifGenerationMatch preserved across save() calls #217

@paulmelnikow

Description

@paulmelnikow

Blocked


I'm using file('example', { generation: 0 }).save() and discovered a strange behavior. I've managed to get resumable saves stuck in my config store, and as a result, when I subsequently invoke file('example').save(), the ifGenerationMatch header is still present on the response.

This is caused by the resumable upload code, which is turned on by default. I'm not sure whether the bug is here or in that library.

Steps to reproduce:

const bucket = new Storage({ projectId }).bucket(bucketName)

await bucket.file('example').save('hello', { resumable: false })

try {
  await bucket.file('example', { generation: 0 }).save('hello')
} catch (e) {
  // Catch a precondition failure
}

// Saves a new version as expected.
await bucket.file('example').save('hello', { resumable: false })

// Expected to save a new version, but throws precondition failure
await bucket.file('example').save('hello')

Metadata

Metadata

Labels

🚨This issue needs some love.api: storageIssues related to the googleapis/nodejs-storage API.priority: p2Moderately-important priority. Fix may not be included in next release.status: blockedResolving the issue is dependent on other work.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions