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

STORAGE_EMULATOR_HOST not handled correctly #2069

Closed
mgabeler-lee-6rs opened this issue Sep 20, 2022 · 9 comments · Fixed by #2070
Closed

STORAGE_EMULATOR_HOST not handled correctly #2069

mgabeler-lee-6rs opened this issue Sep 20, 2022 · 9 comments · Fixed by #2070
Assignees
Labels
api: storage Issues related to the googleapis/nodejs-storage API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@mgabeler-lee-6rs
Copy link
Contributor

This is a rehash of #1314, which was somehow "fixed" by adding comments internal to the implementation.

Environment details

  • OS: Linux
  • Node.js version: 14.x
  • npm version: doesn't matter
  • @google-cloud/storage version: 5.8.5

Steps to reproduce

  1. Set STORAGE_EMULATOR_HOST to http://localhost:NNN
  2. Try to use the library

As described in #1314, the distinction in the Storage constructor between apiEndpoint and baseUrl is not handled correctly when this environment variable is used. There is no possible value for this environment variable that results in a fully functioning client.

The proposed fix in that issue also seems to work just fine, so will submit a PR

@mgabeler-lee-6rs mgabeler-lee-6rs added priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Sep 20, 2022
@product-auto-label product-auto-label bot added the api: storage Issues related to the googleapis/nodejs-storage API. label Sep 20, 2022
@shaffeeullah shaffeeullah self-assigned this Sep 20, 2022
mgabeler-lee-6rs added a commit to mgabeler-lee-6rs/nodejs-storage that referenced this issue Sep 20, 2022
@shaffeeullah
Copy link
Contributor

Hi @mgabeler-lee-6rs ,

Thanks for following up on this issue. Is there a reason that apiEndpoint doesn't satisfy your use case? EMULATOR_HOST is an experimental variable meant to be used for some internal tests.

@mgabeler-lee-6rs
Copy link
Contributor Author

Setting apiEndpoint requires modifying every application, often in multiple places, creating frustration & confusion, especially if some applications are third party.

Having an environment variable like this is incredibly handy for developer environments, for the same reason as the PUBSUB_EMULATOR_HOST is similarly helpful for that system. Multiple emulators for GCS are available (my team is looking at https://github.com/fsouza/fake-gcs-server FWIW), and being able to use one would greatly simplify my organization's developer environments.

From a more abstract point of view, in the current implementation there is no possible value for the STORAGE_EMULATOR_HOST environment variable that works properly, and that seems like it ought to be fixed :)

@mgabeler-lee-6rs
Copy link
Contributor Author

mgabeler-lee-6rs commented Sep 20, 2022

Also, that environment variable is documented as "publicly" supported by the Go client, and I would hope that parity is desirable: https://pkg.go.dev/cloud.google.com/go/storage#hdr-Creating_a_Client

Since my org uses a mix of NodeJS and Go, such parity would certainly benefit us :)

@shaffeeullah
Copy link
Contributor

@mgabeler-lee-6rs ,

Thanks for explaining this! I can totally see how the current developer experience is frustrating for your situation. I'm discussing this issue with our internal partners (like Go) to make sure that our implementations are consistent. I'll keep this issue updated.

@mgabeler-lee-6rs
Copy link
Contributor Author

@shaffeeullah any updates you can share from those discussions?

@shaffeeullah
Copy link
Contributor

@mgabeler-lee-6rs This looks good! 🎉 There is a code freeze in place until October 11. We will release this change after the freeze ends.

@mgabeler-lee-6rs
Copy link
Contributor Author

That sounds great, thank you!

ddelgrosso1 pushed a commit that referenced this issue Oct 18, 2022
* fix: correct STORAGE_EMULATOR_HOST handling (#2069, #1314)

credit to @jpambrun for identifying the fix

* fix: normalize baseUrl

Co-authored-by: Daniel Bankhead <dan@danielbankhead.com>

* fix: adjust URL normalization & tests for consistency

Co-authored-by: Daniel Bankhead <dan@danielbankhead.com>
@mgabeler-lee-6rs
Copy link
Contributor Author

Since the proposed fix broke something and was insta-reverted, can this be re-opened pending finding a more compatible solution?

@danielbankhead
Copy link
Member

@mgabeler-lee-6rs I created a follow-up issue: #2092

This will be a breaking change and we'll need to coordinate a release with Firebase.

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/nodejs-storage API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants