[GH-ISSUE #940] invalid bucket name #147

Closed
opened 2026-03-03 12:08:42 +03:00 by kerem · 3 comments
Owner

Originally created by @enumag on GitHub (Oct 5, 2022).
Original GitHub issue: https://github.com/fsouza/fake-gcs-server/issues/940

I'm trying to create a bucket using the curl commands from readme:

curl -i -X POST http://0.0.0.0:4443/storage/v1/b \
   -H 'Content-Type: application/json' \
   -d '{"kind":"storage#buckets","items":[{"kind":"storage#bucket","id":"sample-bucket","name":"sample-bucket"}],"prefixes":null}'

However it fails like this:

HTTP/1.1 400 Bad Request
Content-Type: application/json
Date: Wed, 05 Oct 2022 11:12:35 GMT
Content-Length: 69

{"error":{"code":400,"message":"invalid bucket name","errors":null}}
Originally created by @enumag on GitHub (Oct 5, 2022). Original GitHub issue: https://github.com/fsouza/fake-gcs-server/issues/940 I'm trying to create a bucket using the curl commands from readme: ``` curl -i -X POST http://0.0.0.0:4443/storage/v1/b \ -H 'Content-Type: application/json' \ -d '{"kind":"storage#buckets","items":[{"kind":"storage#bucket","id":"sample-bucket","name":"sample-bucket"}],"prefixes":null}' ``` However it fails like this: ``` HTTP/1.1 400 Bad Request Content-Type: application/json Date: Wed, 05 Oct 2022 11:12:35 GMT Content-Length: 69 {"error":{"code":400,"message":"invalid bucket name","errors":null}} ```
kerem 2026-03-03 12:08:42 +03:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@fsouza commented on GitHub (Oct 6, 2022):

Hey @enumag, thanks for opening this issue. It seems that you're using the wrong payload? The docs have more info: https://cloud.google.com/storage/docs/json_api/v1/buckets/insert

The payload should be something like {"name":"sample-bucket"}.

<!-- gh-comment-id:1269252401 --> @fsouza commented on GitHub (Oct 6, 2022): Hey @enumag, thanks for opening this issue. It seems that you're using the wrong payload? The docs have more info: https://cloud.google.com/storage/docs/json_api/v1/buckets/insert The payload should be something like `{"name":"sample-bucket"}`.
Author
Owner

@enumag commented on GitHub (Oct 6, 2022):

I was using the payload from readme: https://github.com/fsouza/fake-gcs-server#preload-data

<!-- gh-comment-id:1269422085 --> @enumag commented on GitHub (Oct 6, 2022): I was using the payload from readme: https://github.com/fsouza/fake-gcs-server#preload-data
Author
Owner

@fsouza commented on GitHub (Oct 6, 2022):

The example in the README is a list request with no payload.

{"kind":"storage#buckets","items":[{"kind":"storage#bucket","id":"sample-bucket","name":"sample-bucket"}],"prefixes":null} is the response, not payload.

Let me know if there are any changes that we can make to the README to make this clearer.

<!-- gh-comment-id:1269925788 --> @fsouza commented on GitHub (Oct 6, 2022): The example in the README is a list request with no payload. `{"kind":"storage#buckets","items":[{"kind":"storage#bucket","id":"sample-bucket","name":"sample-bucket"}],"prefixes":null}` is the response, not payload. Let me know if there are any changes that we can make to the README to make this clearer.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/fake-gcs-server#147
No description provided.