mirror of
https://github.com/fsouza/fake-gcs-server.git
synced 2026-04-26 06:05:54 +03:00
[GH-ISSUE #810] Golang client - Error 401: Anonymous caller does not have storage.objects.get access to the Google Cloud Storage object #133
Labels
No labels
bug
compatibility-issue
docker
documentation
enhancement
help wanted
needs information
pull-request
question
stale
unfortunate
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/fake-gcs-server#133
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @alexgille on GitHub (Jun 3, 2022).
Original GitHub issue: https://github.com/fsouza/fake-gcs-server/issues/810
Hi,
I use the Docker image to ease local development in Golang but my component can't interact with the emulator as the Golang GCS client raises the following error :
Error 401: Anonymous caller does not have storage.objects.get access to the Google Cloud Storage objectMy GCS client is the one provided by the Golang package
https://pkg.go.dev/cloud.google.com/go/storage.As stated in Google's documentation, I export the following variable to have the package shoot the emulator :
export STORAGE_EMULATOR_HOST='localhost:4443'Would you have, by chance, ever faced this issue before? And maybe a solution?
Thanks,
Best regards
@fsouza commented on GitHub (Jun 4, 2022):
Hmm I don't remember exactly why in our Go example that we execute in CI we set
STORAGE_EMULATOR_HOSTand then manually set the endpoint in code too. I wonder if there's something missing in the Go SDK. Could be that the error message is misleading too (unlikely, since it's referencing a 401). In either case, can you double check that the server is running with the http scheme? How did you start the container?I can try to play around with this later, but I don't have much info right now.
@alexgille commented on GitHub (Jun 6, 2022):
Hello,
You were right about the endpoint override in the client.
Now it works after adding
option.WithEndpoint("http://localhost:4443")and the environment prepared withexport STORAGE_EMULATOR_HOST='localhost:4443'.It seems that both are needed to work locally with the emulator.
Thanks,
Regards