mirror of
https://github.com/fsouza/fake-gcs-server.git
synced 2026-04-25 21:55:56 +03:00
[GH-ISSUE #270] Internal Error when trying to upload with signed URLs #2204
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#2204
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 @ex-nerd on GitHub (Jun 13, 2020).
Original GitHub issue: https://github.com/fsouza/fake-gcs-server/issues/270
Extracted from my (now-removed) comment on #217 since it seems to be related, but not identical to that problem.
I'm trying to mimic signed upload URLs. I know my code (with a URL generated by GCS/KMS) works against actual GCS but attempts to generate a URL that will work with fake-gcs-server results in
Internal Error.My replication code looks something like this:
This results in a response with an error message claiming
invalid character '-' in numeric literal\nI've tracked this down to a problem in
loadMetadataexpecting some form of JSON data but my actual body looks like this:If I add
&uploadType=multipartto my URL to force this into a multipart upload, the error changes toinvalid character 'h' in literal true (expecting 'r')\nfrom theif err != io.EOFcheck inmultipartUpload().P.S. It'd be really handy if there was a way to do a stack trace for those errors ... I was lazy and added a bunch of prefix text to the error messages to figure out which was which, but it was a bit tedious.
@ex-nerd commented on GitHub (Jun 13, 2020):
One other minor point. GCS returns a
204for signed POST requests, not a200@ex-nerd commented on GitHub (Jun 17, 2020):
Additionally, the upload seems to be pulling the
keyfrom thenamequery string property (similarly tomedia) or from the file metadata, rather than from the URL path itself.A standard signed URL request looks like this:
I assume the key name is embedded in the signature (at least for verification purposes), but the bucket and key name are also right there on the URL. It would make much more sense for fake-gcs-server to honor the key name on the URL path rather than require a separate nonstandard property that GCS seems happy to ignore.
Note: I discovered this issue when using
uploadType=mediaas a workaround for this bug, so that may also need similar behavior (I don't know how that particularuploadTypeworks in actual GCS).@Sytten commented on GitHub (Jun 28, 2021):
Same error here, is there a work around except the media?
The JSON body is really not standard, the form is the usual way of sending the parameters.
@Sytten commented on GitHub (Jun 29, 2021):
Ok I understand it is because we use the form upload which is in the XML API: https://cloud.google.com/storage/docs/xml-api/post-object-forms#html