Node.js - realFetch.call is not a function
See original GitHub issueTrying to use this in a node.js worker and seeing error realFetch.call is not a function
(node:41803) UnhandledPromiseRejectionWarning: TypeError: realFetch.call is not a function
at ../node_modules/isomorphic-fetch/fetch-npm-node.js.module.exports (/Users/kevzettler/code/hypeworks/build/webpack:/node_modules/isomorphic-fetch/fetch-npm-node.js:8:1)
at AssetStore.<anonymous> (/Users/kevzettler/code/hypeworks/build/webpack:/AssetStore.ts:47:30)
at step (/Users/kevzettler/code/hypeworks/build/0.server.worker.js:36403:23)
at Object.next (/Users/kevzettler/code/hypeworks/build/0.server.worker.js:36384:53)
at /Users/kevzettler/code/hypeworks/build/0.server.worker.js:36378:71
at new Promise (<anonymous>)
at ./AssetStore.ts.__awaiter (/Users/kevzettler/code/hypeworks/build/0.server.worker.js:36374:12)
at AssetStore../AssetStore.ts.AssetStore.fetchBinary (/Users/kevzettler/code/hypeworks/build/0.server.worker.js:36443:16)
at executeAction (/Users/kevzettler/code/hypeworks/build/webpack:/node_modules/mobx/lib/mobx.module.js:928:1)
at AssetStore.fetchBinary (/Users/kevzettler/code/hypeworks/build/webpack:/node_modules/mobx/lib/mobx.module.js:915:1)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:13
- Comments:7
Top Results From Across the Web
How to use the node-fetch.call function in node-fetch | Snyk
To help you get started, we've selected a few node-fetch.call examples, ... { url = 'https:' + url } return realFetch.call(this, url, options)...
Read more >Isomorphic fetch not working for external requests?
I got node version 5.9.0 and lates express from npm. Can your log what response.json() returns? – Роман Парадеев. May 3, ...
Read more >Deprecated APIs | Node.js v19.3.0 Documentation
This means there will not be deprecation warnings for Buffer() usage in ... Beginning in Node.js v11.0.0, calling these functions with digest set...
Read more >isomorphic-fetch - Bountysource
Trying to use this in a node.js worker and seeing error realFetch.call is not a function (node:41803) UnhandledPromiseRejectionWarning: TypeError: ...
Read more >Cannot use node-fetch in lambda function - Support
I keep getting an error r is not a function on the line when I call fetch . My package.json includes "node-fetch": "^2.6.0"...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think it’s a bug from
node-fetch
because it tagged itself asmodule
see here so webpack load its .mjs instead of .js despite their exports have different semantics(scroll former two links to bottom to see the differences)I guess you may in a isomorphic case, if so try to indicate webpack that
node-fetch
should be treated as it’s commonjs module viawebpack.config.js
:Same issue here. We’ve switched to
cross-fetch
as well which solves the issue for us.FYI we’ve made it work with
isomorphic-fetch
with the following configuration but we thought it was too brittle to keep:With our
target
setting set tonode
the default formainFields
was['module', 'main']
.We’ve also tried to made it per-dependency for both
node-fetch
and/orisomorphic-fetch
by doing the following but this one did not work: