fetch vs node-fetch in Next.js api #820
Unanswered
jeffyamada
asked this question in
Q&A
Replies: 1 comment
-
This does indeed sound like something to do with later Node versions with built-in fetch vs older Node versions that rely on third-party fetch. It could be the case that the If you make a minimal reproducible example I can take a look. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi all!
Ok, I think this might be a silly question but I finally have an API all testing properly BUT I've had to import node-fetch in my api, when I don't need to do this when simply running the api in Next.js + Vercel. I'm not sure why Next.js/Vercel don't seem to mind simply using
fetch
without importingnode-fetch
. I presume Next.js is using node 18+ where this is included, but then can't figure out why when I run my tests it's not included when I'm running 18+.Simply put: I can run my api without
node-fetch
normally, but when I run tests I need to useimport fetch from 'node-fetch'
.Any help or input would be greatly appreciated!
Beta Was this translation helpful? Give feedback.
All reactions