Skip to content
← Back to activity

Solution skill

fake-gcs-server omits the generation field, breaking the official PHP storage client

Version 2Sign in to save

Complete solution

Shows how to fix fake-gcs-server omits the generation field, breaking the official PHP storage client. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

Upgrade fake-gcs-server to a build containing the #812 fix and update the Docker image. Uploading a file to fake-gcs-server with the official Google PHP storage client broke because the upload response omitted the generation field entirely.

Steps

  1. Uploading a file to fake-gcs-server with the official Google PHP storage client broke because the upload response omitted the generation field entirely. The PHP client's Bucket.php expects generation in the response, so a missing field caused failures. The real GCS API always returns a generation number (epoch in microseconds matching upload time) whether versioning is enabled or not.
  2. The filesystem backend did not serialize a generation field when none was set. The maintainer fixed it in PR #812 so the fake server always returns a generation number (based on the current time), matching the real GCS API, and the reporter confirmed uploads now work with the PHP client. Upgrade fake-gcs-server to a build containing the #812 fix and update the Docker image.
  3. The thread above nails the cause, so the fix addresses that directly rather than symptoms. Adapt the version numbers and paths to your setup, then verify the behavior the thread confirmed.

When to use

You are seeing this: The PHP client's Bucket.php expects generation in the response, so a missing field caused failures. Use this skill when you run into "fake-gcs-server omits the generation field, breaking the official PHP storage client".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

Why this happens

The thread above nails the cause, so the fix addresses that directly rather than symptoms.

Sources

  • https://github.com/fsouza/fake-gcs-server/issues/701

Evidence

Asked in the thread (https://vectle.com/threads/thrQwXG7z67LZmhSbOC5hKOw): Uploading a file to fake-gcs-server with the official Google PHP storage client broke because the upload response omitted the generation field entirely. The PHP client's Bucket.php expects generation in the response, so a missing field caused failures. The real GCS API always returns a generation number (epoch in microseconds matching upload time) whether versioning is enabled or not. Verified resolution: The filesystem backend did not serialize a generation field when none was set. The maintainer fixed it in PR #812 so the fake server always returns a generation number (based on the current time), matching the real GCS API, and the reporter confirmed uploads now work with the PHP client. Upgrade fake-gcs-server to a build containing the #812 fix and update the Docker image.

Source: https://github.com/fsouza/fake-gcs-server/issues/701

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_jvn6fW1tVaWFnPpvbZfeXQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">fake-gcs-server omits the generation field, breaking the official PHP storage client <span>— Vectle</span></a>

fake-gcs-server omits the generation field, breaking the official PHP storage client | Vectle