Closed nbxNTC closed 2 years ago
I encountered the same issue, but I see it's now closed. What is the solution?
@chuckdries looks like someone found the solution here. It's an issue with naming, but they never told us what the name should be
EDIT:
Found the real solution here - it's the permissions for your api's GET content-type endpoint. You can tweak it in the strapi admin page like this: https://stackoverflow.com/a/72777164/19563129.
@nbxNTC Why did you closed this thread I followed the exact same steps on https://strapi.io/blog/announcing-the-strapi-starter-cli and https://strapi.io/blog/build-a-static-blog-with-gatsby-and-strapi
"gatsby-source-strapi" threw an error while running the sourceNodes lifecycle:
Request failed with status code 403
I've added a .env.development
STRAPI_TOKEN=128b964c... a9109424
STRAPI_API_URL=http://localhost:1337
And I've checked the roles for the token I've added, they all are fine
and here is gatsby-config.js
require("dotenv").config({
path: `.env.${process.env.NODE_ENV}`,
})
module.exports = {
plugins: [
"gatsby-plugin-gatsby-cloud",
"gatsby-plugin-postcss",
{
resolve: "gatsby-source-strapi",
options: {
/* trying without env vars, directly with the values */
apiURL: "http://localhost:1337",
accessToken: "128b964c89b496...a336db4a9109424",
collectionTypes: [
{
singularName: "article",
queryParams: {
publicationState:
process.env.GATSBY_IS_PREVIEW === "true" ? "preview" : "live",
populate: {
cover: "*",
blocks: {
populate: "*",
},
},
},
},
{
singularName: "author",
},
{
singularName: "category",
},
],
singleTypes: [
{
singularName: "about",
queryParams: {
populate: {
blocks: {
populate: "*",
},
},
},
},
{
singularName: "global",
queryParams: {
populate: {
favicon: "*",
defaultSeo: {
populate: "*",
},
},
},
},
],
},
},
"gatsby-plugin-image",
"gatsby-plugin-sharp",
"gatsby-transformer-sharp",
"gatsby-transformer-remark",
],
}
What is missing please ?
I've been able to unblock by generating a new token with full access and changing localhost to 127.0.0.1
STRAPI_TOKEN=223c... b234
STRAPI_API_URL=http://127.0.0.1:1337
Now i'm not anymore stuck on the 403 but I've got the following error
ERROR #85923 GRAPHQL
There was an error in your GraphQL query:
Cannot query field "strapiGlobal" on type "Query".
If you don't expect "strapiGlobal" to exist on the type "Query" it is most likely a typo. However, if you expect "strapiGlobal" to exist there are
a couple of solutions to common problems:
- If you added a new data source and/or changed something inside gatsby-node/gatsby-config, please try a restart of your development server.
- You want to optionally use your field "strapiGlobal" and right now it is not used anywhere.
It is recommended to explicitly type your GraphQL schema if you want to use optional fields.
File: src/components/seo.js:8:7
See our docs page for more info on this error: https://gatsby.dev/creating-type-definitions
for all templates of the starter kit : about.js, ... Is this starter code really supposed to work ?
I've fixed my issue : here is what I did : https://github.com/strapi/starters-and-templates/issues/38#issuecomment-1402039344
I just installed gatsby-blog starter and got some errors when the installation is concluded and the project starts automatically.
Running just the backend, all works properly, but when running the frontend, I got some errors.
Errors
Steps to reproduce
yarn create strapi-starter my-project gatsby-blog
yarn develop
on my-project folder.Version
Npm: 6.14.17 Node: 14.19.3 Yarn: 1.22.19 Frontend dependencies: