[GH-ISSUE #590] Allow specification of Location #108

Closed
opened 2026-03-03 12:08:21 +03:00 by kerem · 4 comments
Owner

Originally created by @mdedetrich on GitHub (Oct 4, 2021).
Original GitHub issue: https://github.com/fsouza/fake-gcs-server/issues/590

I am attempting to use face-gcs-server along with Alpakka, specifically https://github.com/akka/alpakka/tree/master/google-cloud-storage/src and I am currently experiencing the issue where when you try to get the details of a bucket (i.e. GET http://0.0.0.0//storage/v1/b/<some-bucket>) the response is missing the location field in the JSON.

I understand that fake-gcs-server doesn't return a location field because fake-gcs-server doesn't really have a concept of location but since its a mandatory field this is causing alpakka gcs client to not work, the JSON deserialization is failing with

Message: Object is missing required member 'location'

Maybe it makes sense to add a -location parameter the options which can hardcode a location (such as "EUROPE-WEST3")? Alternately when you create a bucket that specifies a location this can be persisted so that its returned whenever you do GET http://0.0.0.0//storage/v1/b/<some-bucket>.

Originally created by @mdedetrich on GitHub (Oct 4, 2021). Original GitHub issue: https://github.com/fsouza/fake-gcs-server/issues/590 I am attempting to use face-gcs-server along with [Alpakka](https://github.com/akka/alpakka), specifically https://github.com/akka/alpakka/tree/master/google-cloud-storage/src and I am currently experiencing the issue where when you try to get the details of a bucket (i.e. `GET http://0.0.0.0//storage/v1/b/<some-bucket>`) the response is missing the `location` field in the JSON. I understand that fake-gcs-server doesn't return a `location` field because fake-gcs-server doesn't really have a concept of `location` but since its a mandatory field this is causing alpakka gcs client to not work, the JSON deserialization is failing with ``` Message: Object is missing required member 'location' ``` Maybe it makes sense to add a `-location` parameter the options which can hardcode a location (such as `"EUROPE-WEST3"`)? Alternately when you create a bucket that specifies a `location` this can be persisted so that its returned whenever you do `GET http://0.0.0.0//storage/v1/b/<some-bucket>`.
kerem 2026-03-03 12:08:21 +03:00
Author
Owner

@fsouza commented on GitHub (Oct 4, 2021):

Yeah if that's a parameter on bucket creation we should persist it and return where applicable.

Do you know if any other fields are missing?

<!-- gh-comment-id:933398617 --> @fsouza commented on GitHub (Oct 4, 2021): Yeah if that's a parameter on bucket creation we should persist it and return where applicable. Do you know if any other fields are missing?
Author
Owner

@mdedetrich commented on GitHub (Oct 4, 2021):

Do you know if any other fields are missing?

Unfortunately the JSON parser that is used short circuits as soon as it finds the first missing field so I only know that the location field is missing but for reference these are the fields that its looking for (all of which are mandatory)

/**
 * Represents a bucket in Google Cloud Storage.
 *
 * @param name The name of the bucket
 * @param location The location of the bucket, object data for objects in the bucket resides in physical storage within this region, Defaults to US.
 * @param kind The kind of item this is
 * @param id The ID of the bucket
 * @param selfLink The URI of this bucket
 * @param etag HTTP 1.1 Entity tag for the bucket
 */
final class Bucket private (
    val name: String,
    val location: String,
    val kind: String,
    val id: String,
    val selfLink: String,
    val etag: String
)

If this is not helpful enough I can print out the response to see if there are any other missing fields?

<!-- gh-comment-id:933407659 --> @mdedetrich commented on GitHub (Oct 4, 2021): > Do you know if any other fields are missing? Unfortunately the JSON parser that is used short circuits as soon as it finds the first missing field so I only know that the `location` field is missing but for reference these are the fields that its looking for (all of which are mandatory) ```scala /** * Represents a bucket in Google Cloud Storage. * * @param name The name of the bucket * @param location The location of the bucket, object data for objects in the bucket resides in physical storage within this region, Defaults to US. * @param kind The kind of item this is * @param id The ID of the bucket * @param selfLink The URI of this bucket * @param etag HTTP 1.1 Entity tag for the bucket */ final class Bucket private ( val name: String, val location: String, val kind: String, val id: String, val selfLink: String, val etag: String ) ``` If this is not helpful enough I can print out the response to see if there are any other missing fields?
Author
Owner

@fsouza commented on GitHub (Oct 4, 2021):

Oh ok from that type definition I assume the only thing missing is location. I can work on it some time this week, but let me know if you'd prefer to send a PR.

I think we probably want to:

  • take the region on createBucket
  • include it on getBucket
  • (maybe?) have a default region that's used for buckets sourced from the disk on startup
<!-- gh-comment-id:933899371 --> @fsouza commented on GitHub (Oct 4, 2021): Oh ok from that type definition I assume the only thing missing is location. I can work on it some time this week, but let me know if you'd prefer to send a PR. I think we probably want to: - take the region on createBucket - include it on getBucket - (maybe?) have a default region that's used for buckets sourced from the disk on startup
Author
Owner

@mdedetrich commented on GitHub (Oct 4, 2021):

I can work on it some time this week, but let me know if you'd prefer to send a PR.

I am not that familiar with Go and its not that urgent for me so I am happy waiting if you are fine with working on it (otherwise let me know and I will try and work on it later on).

I think we probably want to:

take the region on createBucket
include it on getBucket
(maybe?) have a default region that's used for buckets sourced from the disk on startup

Yup sounds great from my end, having a command line arg such as default-region seems appropriate for the last point

<!-- gh-comment-id:933904446 --> @mdedetrich commented on GitHub (Oct 4, 2021): > I can work on it some time this week, but let me know if you'd prefer to send a PR. I am not that familiar with Go and its not that urgent for me so I am happy waiting if you are fine with working on it (otherwise let me know and I will try and work on it later on). > I think we probably want to: > take the region on createBucket > include it on getBucket > (maybe?) have a default region that's used for buckets sourced from the disk on startup Yup sounds great from my end, having a command line arg such as `default-region` seems appropriate for the last point
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#108
No description provided.