Closed jasewarner closed 2 years ago
It seems your problem is that gatsby-source-strapi v1 is not compatible with Strapi v4.
For Strapi v4 support, please use version 2.x.x of this source plugin instead. The latest is the beta.0, but we'll release the stable later today
Ah, I see! The README opens with "This version of gatsby-source-strapi
(1.0.2) is only compatible with Strapi v4", hence the confusion.
Yes the code on master is the one published on the beta releases, so it's not the default on npm, I understand the confusion
We just released the stable 2.0.0 version FYI
Thanks for the latest release. Unfortunately after upgrading to 2.0.0
I've come across a new error when running gatsby develop
. Here's an error of the snippet with some context:
success createSchemaCustomization - 0.013s
ERROR #11321 PLUGIN
"gatsby-source-strapi" threw an error while running the sourceNodes lifecycle:
connect ECONNREFUSED 127.0.0.1:80
> Error: connect ECONNREFUSED 127.0.0.1:80
warn The gatsby-source-strapi plugin has generated no Gatsby nodes. Do you need it?
success Checking for changed pages - 0.002s
Could you share your gatsby-config.js file?
Yep, with pleasure. Thank you for your help on this!
Here's the entirety of my gatsby-config.js
file (I'm migrating from a static Gatsby build to Strapi, so excuse the mess).
require('dotenv').config({
path: `.env.${process.env.NODE_ENV}`,
})
const autoprefixer = require('autoprefixer');
module.exports = {
siteMetadata: {
title: `Lorem ipsum`, // TODO: update this
siteUrl: `https://someurl.com/`, // TODO: update this
description: `Lorem ipsum dolor sit amet, consectetur adipiscing elit.` // TODO: update this
},
plugins: [
`gatsby-plugin-gatsby-cloud`,
`gatsby-plugin-image`,
{
resolve: `gatsby-plugin-manifest`,
options: {
name: `DUSK`,
start_url: `/`,
background_color: `#fff`,
theme_color: `#000`,
display: `standalone`,
icon: `./src/icons/favicon.svg`
},
},
`gatsby-plugin-react-helmet`,
{
resolve: `gatsby-plugin-sass`,
options: {
postCssPlugins: [
autoprefixer()
]
}
},
`gatsby-plugin-sitemap`,
`gatsby-plugin-styled-components`,
{
resolve: `gatsby-source-strapi`,
options: {
apiUrl: process.env.STRAPI_API_URL,
accessToken: process.env.STRAPI_TOKEN,
singleTypes: [
{
singularName: `global`,
},
{
singularName: `header`,
},
]
},
},
// {
// resolve: `gatsby-source-filesystem`,
// options: {
// name: `pages`,
// path: `${__dirname}/src/pages/`,
// },
// },
// {
// resolve: `gatsby-source-filesystem`,
// options: {
// name: `data`,
// path: `${__dirname}/src/data/`,
// },
// },
`gatsby-transformer-json`,
`gatsby-transformer-remark`,
`gatsby-transformer-sharp`,
]
};
Could you try with apiURL
instead of apiUrl
in your strapi config?
Oh! Why is it always a typo?!
Ok, thank you for helping me out there 🙏🏻
No problem 🙂
Appreciate any help anyone can give on this one…
I'm running
gatsby-source-strapi
v1.0.2 alongside@strapi/strapi
v4.1.5.This is the relevant part of my
gatsby-config.js
file:The
.env.development
file exists in the root of my Gatsby project folder and consists of the following:After successfully starting up my Strapi instance, when running
gatsby develop
, I get the following error:From what I've read, I feel fairly confident that I have followed all the setup docs to a T.
Why are those two single types coming through as
undefined
? The docs definitely state thatsingularName
should be used.