-
Notifications
You must be signed in to change notification settings - Fork 16
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
UnhandledPromiseRejectionWarning: TypeError: Right-hand side of 'instanceof' is not an object #13
Comments
export more node-fetch exports use isRedirect function directly from node-fetch fix #11 release 1.5.0
You're using nodejs 11.14 or 11.15, right? I noticed that the CI for 11.14 failed yesterday, but the CI also auto-releases when just one of the three tests succeed. That's a bit stupid, but that's how it went. import nodeFetch from "node-fetch";
console.log(nodeFetch);
// { [Function: fetch] isRedirect: [Function], Promise: [Function: Promise] } As you can see, nodeFetch doesn't provide exports like |
In the container using 'FROM node:12.13.0' and on my dev workstation, I have v12.18.3. Normally I don't run the project directly on the dev workstation but did so to troubleshoot this issue. We first saw the issue in production after pushing out a minor update. Once I realize it was an issue in a library and not the changes I had made I did testing on my local workstation to pin down the issue. After locking the libs to "node-fetch": "2.6.0" and "node-fetch-cookies": "1.4.2" by removing the '^' from them and pushing that out to the pipeline/rebuilding/deploying the issue went away in prod. We will be moving to Node 14 once it goes LTS. This project is still in MVP stage so sadly testing did not catch this issue. |
I think your import statement is wrong. node-fetch/lib/index.mjs
I think you should use
See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import I'm by no means an expert or import as been using require for years 😄 |
Yes, you would be correct if
I also tested node-fetch-cookies with both, EDIT: Ok, with node |
This is what I see in node_modules/node-fetch/package.json
console.log(nodeFetch) with "node-fetch": "^2.6.0" and "node-fetch-cookies": "^1.4.2"
Based on the above discussion I was able to fix the issue by modifying
package.json
node -v I also realized I never pointed out I am importing
|
Ah, so that is why we're getting different results. Thanks for the heads up! An explanation of the problem can be found here: https://stackoverflow.com/a/62319801/4780052 Couldn't find a satisfying solution that allows both, nodejs and std/esm import, yet. |
Since 14.5.1 is now LTS, I dropped support for nodejs versions |
With "node-fetch": "2.6.0" and "node-fetch-cookies": "1.4.2" the issue does not exist. With either "node-fetch": "2.6.1" or "node-fetch-cookies": "1.5.0" the below issue happens.
package for reference
The text was updated successfully, but these errors were encountered: