Search code examples
gatsbycontent-typestrapi

Strapi returns 404 error when fetching data from Gatsby


I'm using this Gatsby starter : https://www.gatsbyjs.org/starters/Vagr9K/gatsby-material-starter as I was looking for something to introduce myself both to Gatsby and to Material UI.

My first objective was to change Netlify CMS for Strapi CMS, I've followed these steps:

  1. Removed Netlify plugin, both from gatsby-config.js, package.json and make uninstall.
  2. Added Strapi to the project:
    1. npm install --save gatsby-source-strapi and add the plugin to gatsby-config.js

Here's how I added the Strapi plugin to gatsby-config.js:

Strapi plugin

And here's the error I'm getting:

Strapi 404 status code

I think it might be related to Gatsby not being able to contact the remote Strapi server, any idea on how to solve this?


Solution

  • Okey, so this was a dumb mistake that I just couldn't see: after trying different solutions, which didn't work, I realized that Strapi was trying to fetch data from http://167.172.32.171//posts?_limit=1000, so my problem was that I had an extra / in the URL I indicated to the plugin.