Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create_bucket expects a project even with an emulator "ValueError: Client project not set: pass an explicit project." #699

Closed
oittaa opened this issue Jan 21, 2022 · 0 comments · Fixed by #703
Assignees
Labels
api: storage Issues related to the googleapis/python-storage API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: question Request for information or clarification. Not an issue.

Comments

@oittaa
Copy link

oittaa commented Jan 21, 2022

Thanks for fixing #324. I just noticed that create_bucket still expects a project. Would it make sense that it'd also detect STORAGE_EMULATOR_HOST and use a "fake" project automatically like here?

Environment details

  • OS type and version: MacOS 12.1
  • Python version: python --version Python 3.9.9
  • pip version: pip --version pip 21.3.1
  • google-cloud-storage version: pip show google-cloud-storage 2.1.0

Steps to reproduce

  1. See the example below.

Code example

import os

from google.cloud import storage

HOST = "localhost"
PORT = 9023
BUCKET = "test-bucket"

os.environ["STORAGE_EMULATOR_HOST"] = f"http://{HOST}:{PORT}"
client = storage.Client()

bucket = client.create_bucket(BUCKET)

Stack trace

Traceback (most recent call last):
  File "/Users/user/workspace/temp/test.py", line 12, in <module>
    bucket = client.create_bucket(BUCKET)
  File "/Users/user/workspace/temp/.venv/lib/python3.9/site-packages/google/cloud/storage/client.py", line 940, in create_bucket
    raise ValueError("Client project not set:  pass an explicit project.")
ValueError: Client project not set:  pass an explicit project.
@product-auto-label product-auto-label bot added the api: storage Issues related to the googleapis/python-storage API. label Jan 21, 2022
@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Jan 22, 2022
@tritone tritone added type: question Request for information or clarification. Not an issue. and removed triage me I really want to be triaged. labels Jan 22, 2022
@tritone tritone assigned tritone and cojenco and unassigned tritone Jan 22, 2022
@cojenco cojenco added the priority: p2 Moderately-important priority. Fix may not be included in next release. label Jan 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the googleapis/python-storage API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants