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

5.0.0 doesn't work in Node environment (e.g. with node-fetch) #62

Closed
tessro opened this issue Sep 13, 2021 · 4 comments
Closed

5.0.0 doesn't work in Node environment (e.g. with node-fetch) #62

tessro opened this issue Sep 13, 2021 · 4 comments

Comments

@tessro
Copy link

tessro commented Sep 13, 2021

👋🏼 Hi!

We noticed strange errors when attempting to upgrade 5.0.0, throughout our unit tests. Anywhere we invoked a fetch-retry-wrapped fetch, we got this error:

ReferenceError: Request is not defined

It traces to this PR: #59. Request isn't part of Node's global environment, so this check causes a ReferenceError. This applies regardless of fetch implementation, so I think it will unfortunately break all projects using Node.

I think a typeof Request !== 'undefined' prior to the instanceof check might be enough to fix things for Node. I would normally put up a PR but I'm swamped at the moment -- I can follow up on this when I have more time if that would be helpful.

@knotthere
Copy link

Hi @paulrosania - I will create a PR to support the node environment.

@tessro
Copy link
Author

tessro commented Sep 13, 2021

Thank you!

@jonbern
Copy link
Owner

jonbern commented Sep 14, 2021

Many thanks for reporting the issue, and for suggesting a fix. I have merged @knotthere's PR and published a new release.

@jonbern jonbern closed this as completed Sep 14, 2021
@tessro
Copy link
Author

tessro commented Sep 14, 2021

Thanks both! 5.0.1 is working for us. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants