Closed grgvn closed 2 years ago
Hi,
Once again, many thanks from my team for your great job and theme.
I'm facing an issue I can't resolve by myself, any help or hint would be greatly appreciated.
When sourcing from Strapi, the Gatsby Theme Primer Wiki can't generate the pages anymore, landing on 404.
Being able to source from Strapi, and being able to run Gatsby.
Start a new project : gatsby new wiki https://github.com/theowenyoung/gatsby-starter-primer-wiki
gatsby new wiki https://github.com/theowenyoung/gatsby-starter-primer-wiki
In project root : npx create-strapi-app@latest backend --quickstart // this will create the Strapi backend in /backend
npx create-strapi-app@latest backend --quickstart
Now in Strapi (http://localhost:1337/admin):
Create a Single Type ('Homepage' in my case), put some dummy content in, save, publish
Settings / Users & Permissions Plugin -> give 'find' Permission to 'Public' and to 'Authentificated' on the previously selected Single Type
create an API Token with FULL ACCESS and copy it for later use
Restart strapi (in /backend) : yarn start develop
yarn start develop
And now in Gatsby :
npm install --save gatsby-source-strapi gatsby-plugin-image gatsby-plugin-sharp gatsby-source-filesystem gatsby-transformer-remark gatsby-transformer-sharp // https://www.gatsbyjs.com/plugins/gatsby-source-strapi/
npm install --save gatsby-source-strapi gatsby-plugin-image gatsby-plugin-sharp gatsby-source-filesystem gatsby-transformer-remark gatsby-transformer-sharp
gatsby-config.js, add :
const strapiConfig = { apiURL: 'http://localhost:1337', accessToken: 'your-token', collectionTypes: [], singleTypes: ['homepage'], };
and
{ resolve: `gatsby-source-strapi`, options: strapiConfig, },
gatsby-clean
gatsby-develop
You should see many issues in the Terminal. Looks like the Theme is not able to generate pages anymore and it lands to 404. See complete log
Even if Gatsby crashes, I can see my strapiHomepage nodes in http://localhost:8000/__graphql ; sourcing seems to work.
In gatsby-config.js, changing the singleTypes['homepage'] by any dummy singleType, let's say singleTypes['dummyType'] doesn't generate the error.
singleTypes['homepage']
singleTypes['dummyType']
Gatsby CLI version: 4.16.0 Gatsby version: 4.6.0 Node v16.15.1 Strapi 3.1.0-alpha.5
Distributor ID: Ubuntu Description: Ubuntu 22.04 LTS Release: 22.04 Codename: jammy
Did I miss something huge or is it something with the theme ? Any hint of help to fix this would be greatly appreciated.
Have a great day, Grégoire
Hi,
Once again, many thanks from my team for your great job and theme.
I'm facing an issue I can't resolve by myself, any help or hint would be greatly appreciated.
Problem
When sourcing from Strapi, the Gatsby Theme Primer Wiki can't generate the pages anymore, landing on 404.
Expected
Being able to source from Strapi, and being able to run Gatsby.
Steps to reproduce
Start a new project :
gatsby new wiki https://github.com/theowenyoung/gatsby-starter-primer-wiki
In project root :
npx create-strapi-app@latest backend --quickstart
// this will create the Strapi backend in /backendNow in Strapi (http://localhost:1337/admin):
Create a Single Type ('Homepage' in my case), put some dummy content in, save, publish
Settings / Users & Permissions Plugin -> give 'find' Permission to 'Public' and to 'Authentificated' on the previously selected Single Type
create an API Token with FULL ACCESS and copy it for later use
Restart strapi (in /backend) :
yarn start develop
And now in Gatsby :
npm install --save gatsby-source-strapi gatsby-plugin-image gatsby-plugin-sharp gatsby-source-filesystem gatsby-transformer-remark gatsby-transformer-sharp
// https://www.gatsbyjs.com/plugins/gatsby-source-strapi/gatsby-config.js, add :
and
gatsby-clean
gatsby-develop
You should see many issues in the Terminal. Looks like the Theme is not able to generate pages anymore and it lands to 404. See complete log
Some observations
Even if Gatsby crashes, I can see my strapiHomepage nodes in http://localhost:8000/__graphql ; sourcing seems to work.
In gatsby-config.js, changing the
singleTypes['homepage']
by any dummy singleType, let's saysingleTypes['dummyType']
doesn't generate the error.My config
Gatsby CLI version: 4.16.0 Gatsby version: 4.6.0 Node v16.15.1 Strapi 3.1.0-alpha.5
Distributor ID: Ubuntu Description: Ubuntu 22.04 LTS Release: 22.04 Codename: jammy
Did I miss something huge or is it something with the theme ? Any hint of help to fix this would be greatly appreciated.
Have a great day, Grégoire