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

feat: export fallback from fallback (circular) #803

Merged
merged 2 commits into from
Apr 23, 2020

Conversation

alexander-fenster
Copy link
Contributor

@alexander-fenster alexander-fenster commented Apr 16, 2020

Turns out our code is not perfectly fit for Electron because Electron's client side, even though it's technically a browser, does not respect "browser": field in package.json, so it does not get redirected to build/src/fallback.js automatically. This was reported here: googleapis/nodejs-speech#547

The workaround for this is to prepare a bundle first (with either webpack or browserify), but long term solution would be to change fallback detection logic in the client a little bit. To do it safely, I need this circular export:

> const gax = require('google-gax')
undefined

> gax
{
    ...
    fallback: {
        ...
    }
}

> gax.fallback
{
    ...
    fallback: [Circular]
}

> gax.fallback.fallback
{
    ...
    fallback: [Circular]
}

With this change, we'll be safely forcing users to gax.fallback in the client code if window is defined, without caring much if the "browser": field worked or not.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Apr 16, 2020
@codecov
Copy link

codecov bot commented Apr 16, 2020

Codecov Report

Merging #803 into master will decrease coverage by 0.13%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #803      +/-   ##
==========================================
- Coverage   90.02%   89.89%   -0.14%     
==========================================
  Files          48       48              
  Lines        8113     8123      +10     
  Branches      479      525      +46     
==========================================
- Hits         7304     7302       -2     
- Misses        806      818      +12     
  Partials        3        3              
Impacted Files Coverage Δ
src/fallback.ts 77.64% <100.00%> (+0.53%) ⬆️
.mocharc.js 78.57% <0.00%> (-14.29%) ⬇️
src/normalCalls/retries.ts 93.58% <0.00%> (-5.13%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cc99de0...0a2ea58. Read the comment docs.

@alexander-fenster
Copy link
Contributor Author

Can I ping you on this @bcoe @JustinBeckwith ? Useful for Electron.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants