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

fix: support setting STORAGE_EMULATOR_HOST without /storage/{version} suffix #756

Closed
wants to merge 1 commit into from

Conversation

jack-michaud
Copy link

@jack-michaud jack-michaud commented Apr 6, 2022

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #752 🦕


This is a draft and an attempt to fix #752.

The python client makes a request for a blob using this format (which returns an HTTP 404)

http://localhost:9199/storage/v1/b/redacted-bucket.appspot.com/o/user-uploads%2F4f721203-0103-408c-96aa-526d8e2ac2b1%2Fpublic%2Foriginal%2Fsignal-2021-10-19-122916.jpeg?projection=noAcl&prettyPrint=false

Compared to the NodeJS's implementation, which requests

http://localhost:9199/b/redacted-bucket.appspot.com/o/user-uploads%2F4f721203-0103-408c-96aa-526d8e2ac2b1%2Fpublic%2Foriginal%2Fsignal-2021-10-19-122916.jpeg

The notable difference is that there's no /storage/v1/ prefix. This is similar to the issue called out in firebase/firebase-tools#3508 (comment).

Changing the base URL to a URL which the emulator can handle by following the NodeJS implementation of the STORAGE_EMULATOR_HOST environment variable is my attempt to fix the issue.

It seems to work for getting file blobs, but does not currently work with Uploads (using the test example from #752).

@product-auto-label product-auto-label bot added size: s Pull request size is small. api: storage Issues related to the googleapis/python-storage API. labels Apr 6, 2022
@google-cla
Copy link

google-cla bot commented Apr 6, 2022

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

For more information, open the CLA check for this pull request.

@jack-michaud
Copy link
Author

After further investigation, this PR doesn't fix the issue linked. This still provides a fix for a different issue. I'll make an issue tomorrow to confirm that this approach is reasonable.

@eliasposen-ivy
Copy link

Hey @jack-michaud ! I'm running into this same issue with the latest released package. I don't see your fix in main, was a new issue created to track/resolve this?

Thanks

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. size: s Pull request size is small.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Firebase Storage Emulator Support
2 participants