I have a Wordpress site set up and hosted on Digital Ocean. I’m using Gatsby and gatsby-source-wordpress, a plugin that calls the WordPress API and pulls in blog posts. I’m dynamically assembling pages and deploying a Gatsby site to Netlify.
When trying to deploy my site on Netlify, it fails due to errors (build log pasted below). It seems to be that Netlify isn’t able to fetch the data from the Wordpress API but I’m not sure why that is. I have stored the Wordpress API URL (wp.user.com) as an environment variable on Netlify.
Environment variables on Netlify:
- API_PROTOCOL: http
- API_URL: wp.user.com
- NODE_VERSION: 10
I’ve tested this on my local by replacing my local Wordpress API URL in my .env file with the Wordpress API I’m using for my live site (user.local --> wp.user.com). It fetched all the posts and returned the changes I made so I know that there isn’t an issue with the API. I can’t tell if I have missed an important configuration step on Netlify, if the environment variables are incorrect or if the issue lies elsewhere.
Any help is appreciated!