Home / Companies / Netlify / Blog / Post Details
Content Deep Dive

How to make a fetch request using node-fetch v3

Blog post from Netlify

Post Details
Company
Date Published
Author
Tatyana Novell
Word Count
573
Language
English
Hacker News Points
-
Summary

I've been working on a project using Astro and had an issue with node-fetch v3 not working in my Netlify Serverless Functions, which was caused by a breaking change that made the module no longer compatible with CommonJS. To resolve this issue, I had to update my import statement from `require()` to `import` and also updated my `netlify.toml` file or added `"type": "module"` to my `package.json`, which allows Netlify to recognize the ESM module and fix the error. With these updates, my fetch request is now working as expected.