[GH-ISSUE #2003] gcloud CLI streaming uploads fail due to unsupported body-based resumable uploads #242

Open
opened 2026-03-03 12:09:23 +03:00 by kerem · 0 comments
Owner

Originally created by @danieldanieltata on GitHub (Aug 19, 2025).
Original GitHub issue: https://github.com/fsouza/fake-gcs-server/issues/2003

Problem

The gcloud CLI uses a different approach for resumable uploads when streaming data that was not previously supported by fake-gcs-server.
For example, when running:

tar -czf - examples/gcloud/image.png | gcloud storage cp - gs://fake-bucket/image.tar.gz

The gcloud CLI performs body-based resumable uploads, where object metadata (name, content-type, etc.) is sent in the request body as JSON, rather than as query parameters or headers.
This caused streaming uploads from gcloud CLI to fail against fake-gcs-server.

Steps to Reproduce

  1. Run a streaming upload with gcloud CLI:
echo "test" | gcloud storage cp - gs://fake-bucket/test.txt
  1. Observe that the upload fails due to unsupported body-based resumable upload requests.

Expected Behavior

Streaming uploads from gcloud CLI should work against fake-gcs-server without errors, just like they do with Google Cloud Storage.

Actual Behavior

The server rejects body-based resumable uploads, causing gcloud CLI streaming uploads to fail.

Additional Context

  • This issue blocks using fake-gcs-server as a drop-in replacement for GCS in environments/tests that rely on streaming uploads with gcloud storage cp.
  • Support for body-based resumable uploads would make fake-gcs-server more compatible with real GCS behavior.

Solution

I've already implemented a fix for this issue and opened a PR: #1976.
The PR:

  • Adds support for body-based resumable uploads (handleBodyBasedResumableUpload in upload.go).
  • Fixes a missing CacheControl field in the object response struct.
  • Provides an example script (gcloud-example.sh) to demonstrate usage with gcloud CLI.
    https://github.com/fsouza/fake-gcs-server/pull/1976
Originally created by @danieldanieltata on GitHub (Aug 19, 2025). Original GitHub issue: https://github.com/fsouza/fake-gcs-server/issues/2003 ### Problem The gcloud CLI uses a different approach for resumable uploads when streaming data that was not previously supported by fake-gcs-server. For example, when running: ``` tar -czf - examples/gcloud/image.png | gcloud storage cp - gs://fake-bucket/image.tar.gz ``` The gcloud CLI performs body-based resumable uploads, where object metadata (name, content-type, etc.) is sent in the request body as JSON, rather than as query parameters or headers. This caused streaming uploads from gcloud CLI to fail against fake-gcs-server. ### Steps to Reproduce 1. Run a streaming upload with gcloud CLI: ``` echo "test" | gcloud storage cp - gs://fake-bucket/test.txt ``` 2. Observe that the upload fails due to unsupported body-based resumable upload requests. ### Expected Behavior Streaming uploads from gcloud CLI should work against fake-gcs-server without errors, just like they do with Google Cloud Storage. ### Actual Behavior The server rejects body-based resumable uploads, causing gcloud CLI streaming uploads to fail. ### Additional Context - This issue blocks using fake-gcs-server as a drop-in replacement for GCS in environments/tests that rely on streaming uploads with gcloud storage cp. - Support for body-based resumable uploads would make fake-gcs-server more compatible with real GCS behavior. ### Solution **I've already implemented a fix for this issue and opened a PR:** #1976. The PR: - Adds support for body-based resumable uploads (handleBodyBasedResumableUpload in upload.go). - Fixes a missing CacheControl field in the object response struct. - Provides an example script (gcloud-example.sh) to demonstrate usage with gcloud CLI. https://github.com/fsouza/fake-gcs-server/pull/1976
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/fake-gcs-server#242
No description provided.