Home
Support Forums

Gatsby Function API requests not working

I’m trying to deploy my site to Netlify, but my Gatsby Function API routes are not working.

I’ve followed this guide: How to Enable Gatsby Functions on Netlify

When I go to them directly, I’m served the following error. The only place I have node-fetch is as a dependency of this plugin

Imgur

Appreciate any help

I’m trying to deploy my Gatsby Functions, and have followed the instructions of this guide: How to Enable Gatsby Functions on Netlify

In Gatsby development: the API fetches the reviews correctly
In Netlify development and production: the API throws an error that complains about node-fetch, which is a dependency of the project, and the plugin from the guide^. You can view the full error at the link below:
https://6142267da7a96200077a7dea--of-gatsby.netlify.app/api/get-reviews

Please let me know if I can provide any additional info, appreciate any help/guidance :pray:

What happens when you try to follow what the error says? Could you try to use import for the node-fetch instead of require() ?

It could help if you could share the source code.