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

baseurl is not quite right when using STORAGE_EMULATOR_HOST #1314

Closed
jpambrun opened this issue Oct 16, 2020 · 2 comments · Fixed by #1432 or #2070
Closed

baseurl is not quite right when using STORAGE_EMULATOR_HOST #1314

jpambrun opened this issue Oct 16, 2020 · 2 comments · Fixed by #1432 or #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

@jpambrun
Copy link

I think this line should read:

    const baseUrl = `${EMULATOR_HOST}/storage/v1` || `${options.apiEndpoint}/storage/v1`;

I guess the intend was to have configurable path, not only the host, but it breaks either bucket api or the object api.

Currently, with the default url, we get

config = {
 apiEndpoint: 'https://storage.googleapis.com',
 baseUrl: 'https://storage.googleapis.com/storage/v1',
 //...
}

while with a EMULATOR_HOST= https://exmaple.com we get

config = {
 apiEndpoint: 'https://exmaple.com',
 baseUrl: 'https://exmaple.com',
 //...
}

As a result, when EMULATOR_HOST is set with https://exmaple.com I can create buckets (the url starts with /storage/v1), but can't upload/download file (url starts with /upload/storage/v1). If I set EMULATOR_HOST to https://exmaple.com/v1/storage/ I have the inverse problem (can't create bucket, but can upload/download)

@product-auto-label product-auto-label bot added the api: storage Issues related to the googleapis/nodejs-storage API. label Oct 16, 2020
@stephenplusplus
Copy link
Contributor

cc @jkwlui @frankyn this is the origin discussion: #1161 (comment)

@stephenplusplus
Copy link
Contributor

Thanks for reporting @jpambrun!

@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Oct 17, 2020
@shaffeeullah shaffeeullah 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. and removed triage me I really want to be triaged. labels Oct 20, 2020
@yoshi-automation yoshi-automation added 🚨 This issue needs some love. and removed 🚨 This issue needs some love. labels Jan 18, 2021
@shaffeeullah shaffeeullah self-assigned this Mar 30, 2021
gcf-owl-bot bot added a commit that referenced this issue Dec 30, 2021
Source-Link: googleapis/synthtool@dd6754c
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-nodejs:latest@sha256:f092066de33d4a2a13ab13c8fa9dcb4f6b96fa1fb7d391bf19cd0c4921d997c0
mgabeler-lee-6rs added a commit to mgabeler-lee-6rs/nodejs-storage that referenced this issue Sep 20, 2022
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>
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
4 participants