I am attempting to get a quick prototype up using strapi and gatsby. None of the starters seem to work, so I've tried the quick start quides on the strapi site.
First I followed this quick start guide to get the strapi backend up. https://docs.strapi.io/developer-docs/latest/getting-started/quick-start.html
And then this one to get gatsby running. https://docs.strapi.io/developer-docs/latest/developer-resources/content-api/integrations/gatsby.html#create-a-gatsby-app
And have run into 2 errors.
"gatsby-source-strapi" threw an error while running the sourceNodes lifecycle:
Request failed with status code 403
...
warn The gatsby-source-strapi plugin has generated no Gatsby nodes. Do you need it? This
could also suggest the plugin is misconfigured.
and
There was an error in your GraphQL query:
Cannot query field "allStrapiRestaurant" on type "Query".
I have enabled find/findOne for both restaurants and categories.
All of the assets have been published.
And I tried adding an API access token to the gatsby config and get the same results.
My gatsby config looks like
...
plugins: [
{
resolve: "gatsby-source-strapi",
options: {
apiURL: "http://localhost:1337",
accessToken: process.env.STRAPI_API_TOKEN,
collectionTypes: ["restaurant", "category"],
queryLimit: 1000,
},
},
...
and my package json looks like
{
"name": "gatsby-starter-default",
"private": true,
"description": "A simple starter to get up and developing quickly with Gatsby",
"version": "0.1.0",
"author": "Kyle Mathews <mathews.kyle@gmail.com>",
"dependencies": {
"gatsby": "^4.15.0",
"gatsby-plugin-gatsby-cloud": "^4.15.0",
"gatsby-plugin-image": "^2.15.0",
"gatsby-plugin-manifest": "^4.15.0",
"gatsby-plugin-offline": "^5.15.0",
"gatsby-plugin-react-helmet": "^5.15.0",
"gatsby-plugin-sharp": "^4.15.0",
"gatsby-source-filesystem": "^4.15.0",
"gatsby-source-strapi": "^2.0.0",
"gatsby-transformer-remark": "^5.15.0",
"gatsby-transformer-sharp": "^4.15.0",
"prop-types": "^15.8.1",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-helmet": "^6.1.0"
},
"devDependencies": {
"prettier": "^2.6.2"
},
"keywords": [
"gatsby"
],
"license": "0BSD",
"scripts": {
"build": "gatsby build",
"develop": "gatsby develop",
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,md,css}\"",
"start": "gatsby develop",
"serve": "gatsby serve",
"clean": "gatsby clean",
"test": "echo \"Write tests! -> https://gatsby.dev/unit-testing\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://github.com/gatsbyjs/gatsby-starter-default"
},
"bugs": {
"url": "https://github.com/gatsbyjs/gatsby/issues"
}
}
Another thing I have noticed is that the queries in the quick start guide don't exist when using graphiql. localhosthost:1337/api/restaurants returns the data (minus the relation bit). And in graphiql I can query the data like this:
query {
restaurants{
data{
attributes{
name
}
}
}
}
(this still doesn't allow me to do anything meaningful with strapi because I can't get relations or sort anything, and this also doesn't work in gatsby, just graphiql)