mirror of
https://github.com/fsouza/fake-gcs-server.git
synced 2026-04-25 13:45:52 +03:00
[GH-ISSUE #1753] Unable to upload file to bucket: getting 404 #219
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#219
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 @mswami1 on GitHub (Sep 23, 2024).
Original GitHub issue: https://github.com/fsouza/fake-gcs-server/issues/1753
Error:
Writer.Close: googleapi: Error 404: Not Found, Not Found
docker service:
storage:
image: fsouza/fake-gcs-server
environment:
STORAGE_EMULATOR_HOST: localhost:4443
ports:
- '4443:4443'
command: -scheme http -port 4443 -public-host localhost:4443
volumes:
- .:/gcs_storage
client, err1 := storage.NewClient(context.TODO(), option.WithEndpoint("http://127.0.0.1:4443/storage/v1/"))
@KeithScheiwiller commented on GitHub (Dec 30, 2024):
Did you create a directory within
/storagewith the matching bucket name? I faced the same issue but doing so solved it. I didn't see it mentioned in the docs, but it seems it does not auto-create buckets.@fsouza commented on GitHub (Jan 3, 2025):
Yeah upload will fail if the bucket doesn't exist. I'll keep this open to improve the error message or at least log that the bucket doesn't exist.
@daaain commented on GitHub (Feb 3, 2025):
Does the bucket need to be created with an API call after startup?
I tried mounting a volume with a directory matching the bucket name, but that didn't help.
Also, is
/storagea separate thing from the-dataparameter?@daaain commented on GitHub (Feb 3, 2025):
To answer my own question,
/datais what supposed to be a volume and/storageis the internal backend where*.bucketMetadataand*.metadatafiles get created, so if you set-data /storageand have a volume attached to/storageyou'll get one level deeper*.metadata.metadataon every restart 😅Also, attaching a subdirectory to
/datadoes make the emulator treat it as an existing bucket. Also, files uploaded via the emulator only get written to/storage, but not to/data, so it's just an initial seed.Would be really helpful if this was documented!
So I can upload to the bucket using the gsutil example, but I still get 404 when trying to use a signed URL generated by the Node SDK 🤷 the container logs it so the request gets through, it just returns 404
This is how the logs look like, the first POST is the successful
gsutilupload, then a successful OPTION for CORS and then the 404 signed upload PUT:@daaain commented on GitHub (Feb 3, 2025):
Got it working! Apparently it was a
public-hostmismatch, with this configuration the PUT signed URL did upload:@yassenb commented on GitHub (Apr 8, 2025):
I second documenting this. I was banging my head why no data was persisted even if I had a Docker volume mounted in
/data. It's far from obvious there's another volume that should be persisted and mounted under/storage@gsouf commented on GitHub (Oct 23, 2025):
I'm run running it behind a reverse proxy and I'm also getting the same 404 error.
I don't understand what's the expected value in
public-hostand why it would lead to the upload to fail if it's incorrect.The doc says
Optional URL for public host (default "storage.googleapis.com")but it's not really explaining how that works.Could anyone help to clarify that?
@gsouf commented on GitHub (Oct 23, 2025):
Ok I found out that when it's behind a reverse proxy, it has to be the private url to which the proxy forwards the request too, and not the public uri of the proxy server itself.
It seems that this public-host setting is a pain point for many people out there. Once it works it's ok, but most people, including myself, seemingly waste hours figuring out how to configure it properly