mirror of
https://github.com/fsouza/fake-gcs-server.git
synced 2026-04-25 21:55:56 +03:00
[GH-ISSUE #1391] creating signed url's give with sdk gives AttributeError: you need a private key to sign credentials.the credentials you are currently using <class 'google.auth.credentials.AnonymousCredentials'> just contains a token. #196
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#196
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 @jommpy on GitHub (Nov 7, 2023).
Original GitHub issue: https://github.com/fsouza/fake-gcs-server/issues/1391
I'm using this snippet to create a pre-signed download url
Because this is in a test environment I'm not setting the GOOGLE_APPLICATION_CREDENTIALS because it needs to use the fake-gcs-container.
Any workarounds for this error ? help would be much appriciated.
@fsouza commented on GitHub (Nov 7, 2023):
Signed URLs are a client-side operation, they don't involve neither the real or the fake server. You need to use fake credentials to sign the URL.
When you do send a request to the signed URL, fake-gcs-server will take any signed URL and trust that it's valid.
@ghost commented on GitHub (Jan 9, 2024):
@fsouza I am getting this error when trying to generate signed URLs using the GCS Go CDK:
Which I believe is the same root cause as the original on this issue. Can you provide an example or some docs about how to create the fake/mock credentials?
Thank you
@wlinna commented on GitHub (Jan 10, 2024):
It seems that by default it is the real server that signs the url. The following code is from the node library
So it seems like one should be able to make Storage client use a JWT client internally. I haven't figured that part yet though.
@ghost commented on GitHub (Jan 10, 2024):
I was able to do this by assigning dummy values to
GoogleAccessIDandPrivateKeyin thestorage.SignedURLOptionspassed to theSignedURLfunction. I was hoping to find a way to have the client auto-load these values like it does when accessing real GCS, but it looks like the use ofSTORAGE_EMULATOR_HOSTmay be mutually exclusive withGOOGLE_APPLICATION_CREDENTIALS