question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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')

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
stephenpluspluscommented, Jul 11, 2019
1reaction
stephenpluspluscommented, Jul 11, 2019

And a PR to expose uploadInstance.deleteConfig(): https://github.com/googleapis/gcs-resumable-upload/pull/244. This will have to be re-exposed through the Storage API after it ships in gcs-resumable-upload.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Request preconditions | Cloud Storage
This page discusses request preconditions, which you use to prevent requests from applying to a resource when the resource is in an unexpected...
Read more >
Write file and then upload to cloud storage - NodeJS
If you confirmed that the file is saved locally and just want to upload it to the bucket, you may refer to the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found