Hi, I am trying to set up my project base using gatsby and fauna.
I wonder, that there are like no useful information on how to do this, for this maybe a very relevant setup right now.
What I did so far:
- Init a gatsby project
- netlify init
- netlify addons:create fauna
- netlify addons:auth fauna
- netlify functions:create fauna-graphql`
- cd functions/fauna-graphql && npm i
netlify.toml:
[build]
command = "npm run build"
functions = "functions"
publish = "public"
Used this project to get a hang on how this could work: (it is not building, the packages are outdated)
Used this as a basis: (without gatsby-source-graphql, for I don’t want to use it)
This is the endpoint if I netlify deploy --prod
: (working fine)
https://jointed.netlify.com/.netlify/functions/fauna-graphql
I did add GATSBY_FAUNADB_SERVER_SECRET, and FAUNADB_SERVER_SECRET to env for testing purpose.
The cli did show Error during invocation: [ { message: ‘Invalid database secret.’ } ], but this did not solve it.
If I request
const query = gql { findTestByID(id: "251385935861645826") { name } }
from the netlify dev server, the response is the gatsby index.html from of the public/ folder.
The js console logs: Error: Network error: Unexpected token < in JSON at position 0
If someone set that up, it would be very kind to upload a base template to github for the community.
This really is, what people need to get started.
Please add faunadb to the community tag selection.