[GH-ISSUE #713] Failed to get object with error storage: object doesn't exist @ 1.37.0 #124

Closed
opened 2026-03-03 12:08:30 +03:00 by kerem · 6 comments
Owner

Originally created by @chunming-c on GitHub (Mar 14, 2022).
Original GitHub issue: https://github.com/fsouza/fake-gcs-server/issues/713

Hi, thank you for the work. However, when upgrade to v1.37.0, object was failed to be retrieved by gcs client. The tricky part is the object does exist and accessible by curl.

curl -I --insecure https://0.0.0.0:4443/storage/v1/b/foo/o/bar.txt | jq .

{
  "kind": "storage#object",
  ...
}
func setup() (gcsClient *storage.Client) {
	transCfg := &http.Transport{
		TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
	}
	httpClient := &http.Client{Transport: transCfg}
	gcsClient, _ = storage.NewClient(
		context.TODO(),
		option.WithEndpoint("https://localhost:4443/storage/v1/"),
		option.WithHTTPClient(httpClient),
	)
	return
}

func main() {
	gcsClient := setup()
	obj := gcsClient.Bucket("foo").Object("bar.txt").ReadCompressed(true)

	_, err := obj.NewReader(context.Background())
	if err != nil {
		log.Fatal(err.Error()) // storage: object doesn't exist
	}
}

Version

  • cloud.google.com/go/storage: v1.16.0
  • fake-gcs-server: 1.37.0
Originally created by @chunming-c on GitHub (Mar 14, 2022). Original GitHub issue: https://github.com/fsouza/fake-gcs-server/issues/713 Hi, thank you for the work. However, when upgrade to `v1.37.0`, `object` was failed to be retrieved by gcs client. The tricky part is the object does exist and accessible by `curl`. ``` curl -I --insecure https://0.0.0.0:4443/storage/v1/b/foo/o/bar.txt | jq . { "kind": "storage#object", ... } ``` ```go func setup() (gcsClient *storage.Client) { transCfg := &http.Transport{ TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, } httpClient := &http.Client{Transport: transCfg} gcsClient, _ = storage.NewClient( context.TODO(), option.WithEndpoint("https://localhost:4443/storage/v1/"), option.WithHTTPClient(httpClient), ) return } func main() { gcsClient := setup() obj := gcsClient.Bucket("foo").Object("bar.txt").ReadCompressed(true) _, err := obj.NewReader(context.Background()) if err != nil { log.Fatal(err.Error()) // storage: object doesn't exist } } ``` ### Version - cloud.google.com/go/storage: v1.16.0 - fake-gcs-server: 1.37.0
kerem 2026-03-03 12:08:30 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@fsouza commented on GitHub (Mar 14, 2022):

Hi @chunming-c, can you share how you started the server? Like which arguments you provided to it.

<!-- gh-comment-id:1066523826 --> @fsouza commented on GitHub (Mar 14, 2022): Hi @chunming-c, can you share how you started the server? Like which arguments you provided to it.
Author
Owner

@chunming-c commented on GitHub (Mar 14, 2022):

Yeah sure. The server is started by docker compose with config below

version: '3.9'
services:
    fake-gcs-server:
        container_name: fake-gcs-server
        image: fsouza/fake-gcs-server:1.37.0
        ports:
            - 4443:4443
        volumes:
            - ../../test/gcs_test_bucket:/data/foo
        entrypoint: ['/bin/fake-gcs-server', '-data', '/data', '-public-host', 'localhost']
<!-- gh-comment-id:1066563498 --> @chunming-c commented on GitHub (Mar 14, 2022): Yeah sure. The server is started by docker compose with config below ```yml version: '3.9' services: fake-gcs-server: container_name: fake-gcs-server image: fsouza/fake-gcs-server:1.37.0 ports: - 4443:4443 volumes: - ../../test/gcs_test_bucket:/data/foo entrypoint: ['/bin/fake-gcs-server', '-data', '/data', '-public-host', 'localhost'] ```
Author
Owner

@fsouza commented on GitHub (Mar 14, 2022):

Can you try setting -public-host to localhost:4443?

<!-- gh-comment-id:1066695749 --> @fsouza commented on GitHub (Mar 14, 2022): Can you try setting `-public-host` to `localhost:4443`?
Author
Owner

@nabeelz7 commented on GitHub (Mar 14, 2022):

We were also seeing similar issue as @chunming-c. Then changed our entrypoint -public-host value to the following per @fsouza tip and now it works again in v1.37 (we use 80/http instead of 4443/https):

entrypoint: ["fake-gcs-server", "-backend=filesystem", "-data=/data", "-scheme=http", "-port=80", "-public-host=cloudstorage:80"]

Is this worth an update to README.md @fsouza ?

<!-- gh-comment-id:1067422567 --> @nabeelz7 commented on GitHub (Mar 14, 2022): We were also seeing similar issue as @chunming-c. Then changed our entrypoint `-public-host` value to the following per @fsouza tip and now it works again in v1.37 (we use 80/http instead of 4443/https): ```yaml entrypoint: ["fake-gcs-server", "-backend=filesystem", "-data=/data", "-scheme=http", "-port=80", "-public-host=cloudstorage:80"] ``` Is this worth an update to README.md @fsouza ?
Author
Owner

@chunming-c commented on GitHub (Mar 15, 2022):

Yup it works after change, thanks! But what change caused the issue?

<!-- gh-comment-id:1067500916 --> @chunming-c commented on GitHub (Mar 15, 2022): Yup it works after change, thanks! But what change caused the issue?
Author
Owner

@miklosboros commented on GitHub (Mar 25, 2022):

We had the same issue and I have tracked down the possible change that introduced it. Please, refer to my note at this pull request: PR comment

<!-- gh-comment-id:1079064456 --> @miklosboros commented on GitHub (Mar 25, 2022): We had the same issue and I have tracked down the possible change that introduced it. Please, refer to my note at this pull request: [PR comment](https://github.com/fsouza/fake-gcs-server/pull/712#issuecomment-1079042835)
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#124
No description provided.