You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I started a new project from the Workers tutorial. It's just a simple program that uses node-fetch to make a GET request to an API. Everything was fine until I upgraded node-fetch from V2 to V3 to use a particular feature. When I run wrangler dev, I get this error:
node_modules/fetch-blob/from.js:1:59: ERROR: Could not resolve "node:fs"
node_modules/fetch-blob/from.js:2:25: ERROR: Could not resolve "node:path"
node_modules/node-fetch/src/body.js:8:34: ERROR: Could not resolve "node:stream"
node_modules/node-fetch/src/body.js:9:42: ERROR: Could not resolve "node:util"
node_modules/node-fetch/src/body.js:10:21: ERROR: Could not resolve "node:buffer"
Unfortunately, it's not an option for me to use V2 or builtin fetch. node-fetch/node-fetch#1367 might be related?
Thanks in advance.
The text was updated successfully, but these errors were encountered:
Can I ask why it's not possible for you to use the Workers built-in fetch? It's almost identical in all respects.
node-fetch is almost identical but uses a lot of Node libraries that Workers don't include because Workers are not Node. I'd strongly encourage you to not use node-fetch in Workers because even if you managed to (somehow) polyfill the missing dependencies there's really not much difference between node-fetch and Workers' fetch.
Can I ask why it's not possible for you to use the Workers built-in fetch? It's almost identical in all respects.
Initially I was using the builtin fetch but I needed the insecureHTTPParser option to experiment with a particular API. AFAIK neither node-fetch V2 nor the builtin fetch support it.
I'd strongly encourage you to not use node-fetch in Workers because even if you managed to (somehow) polyfill the missing dependencies there's really not much difference between node-fetch and Workers' fetch.
What version of
Wrangler
are you using?2.0.26
What operating system are you using?
Linux
Describe the Bug
I started a new project from the Workers tutorial. It's just a simple program that uses
node-fetch
to make a GET request to an API. Everything was fine until I upgradednode-fetch
from V2 to V3 to use a particular feature. When I runwrangler dev
, I get this error:Unfortunately, it's not an option for me to use V2 or builtin
fetch
.node-fetch/node-fetch#1367 might be related?
Thanks in advance.
The text was updated successfully, but these errors were encountered: