[GH-ISSUE #587] Update examples to include documentation on how to run/required configuration #106

Open
opened 2026-03-03 12:08:20 +03:00 by kerem · 11 comments
Owner

Originally created by @potatochip on GitHub (Sep 30, 2021).
Original GitHub issue: https://github.com/fsouza/fake-gcs-server/issues/587

Raises error from gcs client

Originally created by @potatochip on GitHub (Sep 30, 2021). Original GitHub issue: https://github.com/fsouza/fake-gcs-server/issues/587 Raises error from gcs client
Author
Owner

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

Can you provide more details? Which command did you run? How did you start the server? What error did you get?

<!-- gh-comment-id:932613752 --> @fsouza commented on GitHub (Oct 1, 2021): Can you provide more details? Which command did you run? How did you start the server? What error did you get?
Author
Owner

@potatochip commented on GitHub (Oct 1, 2021):

$ docker run -d --name fake-gcs-server -p 4443:4443 fsouza/fake-gcs-server
# roughly verbatim from examples/python/python.py
from google.auth.credentials import AnonymousCredentials
from google.cloud import storage

client = storage.Client(
    credentials=AnonymousCredentials(),
    project="test",
)
list(client.list_buckets())
BadRequest: 400 GET https://storage.googleapis.com/storage/v1/b?project=test&projection=noAcl&prettyPrint=false: Unknown project id: 0
<!-- gh-comment-id:932625444 --> @potatochip commented on GitHub (Oct 1, 2021): ```shell $ docker run -d --name fake-gcs-server -p 4443:4443 fsouza/fake-gcs-server ``` ```python # roughly verbatim from examples/python/python.py from google.auth.credentials import AnonymousCredentials from google.cloud import storage client = storage.Client( credentials=AnonymousCredentials(), project="test", ) list(client.list_buckets()) ``` ``` BadRequest: 400 GET https://storage.googleapis.com/storage/v1/b?project=test&projection=noAcl&prettyPrint=false: Unknown project id: 0 ```
Author
Owner

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

Oh I see, it's trying to connect to the real server, you need to set the endpoint, either via an environment variable or the proper parameters in the client.

Take a look on how we do it in CI: https://github.com/fsouza/fake-gcs-server/blob/main/ci/run-python-example.sh.

<!-- gh-comment-id:932634569 --> @fsouza commented on GitHub (Oct 1, 2021): Oh I see, it's trying to connect to the real server, you need to set the endpoint, either via an environment variable or the proper parameters in the client. Take a look on how we do it in CI: https://github.com/fsouza/fake-gcs-server/blob/main/ci/run-python-example.sh.
Author
Owner

@potatochip commented on GitHub (Oct 5, 2021):

Thanks for checking. It does work after doing that. Might want to update documentation to mention env var or other options in order to get things working.

<!-- gh-comment-id:934517806 --> @potatochip commented on GitHub (Oct 5, 2021): Thanks for checking. It does work after doing that. Might want to update documentation to mention env var or other options in order to get things working.
Author
Owner

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

Do you think that replicating the comment at the top of the Go example is enough or do we need more?

<!-- gh-comment-id:934589916 --> @fsouza commented on GitHub (Oct 5, 2021): Do you think that replicating the comment at the top of the [Go example](https://github.com/fsouza/fake-gcs-server/blob/main/examples/go/main.go) is enough or do we need more?
Author
Owner

@potatochip commented on GitHub (Oct 5, 2021):

Should be fine

On Tue, Oct 5, 2021 at 10:57 AM francisco souza @.***>
wrote:

Do you think that replicating the comment at the top of the Go example
https://github.com/fsouza/fake-gcs-server/blob/main/examples/go/main.go
is enough or do we need more?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/fsouza/fake-gcs-server/issues/587#issuecomment-934589916,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ACTKRCGI34WZFOMEI34A2P3UFMU7DANCNFSM5FDL7VQQ
.

<!-- gh-comment-id:934619612 --> @potatochip commented on GitHub (Oct 5, 2021): Should be fine On Tue, Oct 5, 2021 at 10:57 AM francisco souza ***@***.***> wrote: > Do you think that replicating the comment at the top of the Go example > <https://github.com/fsouza/fake-gcs-server/blob/main/examples/go/main.go> > is enough or do we need more? > > — > You are receiving this because you authored the thread. > Reply to this email directly, view it on GitHub > <https://github.com/fsouza/fake-gcs-server/issues/587#issuecomment-934589916>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/ACTKRCGI34WZFOMEI34A2P3UFMU7DANCNFSM5FDL7VQQ> > . >
Author
Owner

@wwwjn commented on GitHub (Apr 22, 2022):

Same problem make me stuck for a while! I believe we might need better documentation for examples. (Cause It's very easy to ignore the comment on the top.

<!-- gh-comment-id:1105989222 --> @wwwjn commented on GitHub (Apr 22, 2022): Same problem make me stuck for a while! I believe we might need better documentation for examples. (Cause It's very easy to ignore the comment on the top.
Author
Owner

@fsouza commented on GitHub (Apr 22, 2022):

@wwwjn where do you think we should put the documentation?

<!-- gh-comment-id:1106017568 --> @fsouza commented on GitHub (Apr 22, 2022): @wwwjn where do you think we should put the documentation?
Author
Owner

@wwwjn commented on GitHub (Apr 22, 2022):

Thanks a lot for your quick response! For example, we can add a short markdown file in the /examples folder.
Btw, Thanks for create such a great project!

<!-- gh-comment-id:1106020529 --> @wwwjn commented on GitHub (Apr 22, 2022): Thanks a lot for your quick response! For example, we can add a short markdown file in the /examples folder. Btw, Thanks for create such a great project!
Author
Owner

@fsouza commented on GitHub (Apr 22, 2022):

Thanks a lot for your quick response! For example, we can add a short markdown file in the /examples folder.
Btw, Thanks for create such a great project!

That's a good idea! We can add the markdown file with the generic information that applies to all examples and then have some inline comments in the code whenever there are any specifics. I will try to find time to work on that on the weekend or early next week.

<!-- gh-comment-id:1106026498 --> @fsouza commented on GitHub (Apr 22, 2022): > Thanks a lot for your quick response! For example, we can add a short markdown file in the /examples folder. > Btw, Thanks for create such a great project! > That's a good idea! We can add the markdown file with the generic information that applies to all examples and then have some inline comments in the code whenever there are any specifics. I will try to find time to work on that on the weekend or early next week.
Author
Owner

@somen440 commented on GitHub (May 1, 2022):

I had a similar problem. The sample worked locally with the following command.

docker run --rm --name fake-gcs-server -p 8080:8080 -v ${PWD}/examples/data:/data fsouza/fake-gcs-server -scheme http -backend memory -port 8080 -public-host localhost:8080
<!-- gh-comment-id:1114079043 --> @somen440 commented on GitHub (May 1, 2022): I had a similar problem. The sample worked locally with the following command. ```sh docker run --rm --name fake-gcs-server -p 8080:8080 -v ${PWD}/examples/data:/data fsouza/fake-gcs-server -scheme http -backend memory -port 8080 -public-host localhost:8080 ```
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#106
No description provided.