Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to get object with error storage: object doesn't exist @ 1.37.0 #713

Closed
chunming-c opened this issue Mar 14, 2022 · 6 comments · Fixed by #728
Closed

Failed to get object with error storage: object doesn't exist @ 1.37.0 #713

chunming-c opened this issue Mar 14, 2022 · 6 comments · Fixed by #728
Labels

Comments

@chunming-c
Copy link

chunming-c commented Mar 14, 2022

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
@fsouza
Copy link
Owner

fsouza commented Mar 14, 2022

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

@chunming-c
Copy link
Author

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

@fsouza
Copy link
Owner

fsouza commented Mar 14, 2022

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

@nabeelz7
Copy link

nabeelz7 commented 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 ?

@chunming-c
Copy link
Author

chunming-c commented Mar 15, 2022

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

@miklosboros
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants