contentful-labs / starter-gatsby-blog

Gatsby starter for a Contentful project from the community.
https://contentful.github.io/starter-gatsby-blog/
MIT License
195 stars 199 forks source link

Setting CONTENTFUL_HOST triggers access error #132

Closed mattgabor closed 3 years ago

mattgabor commented 4 years ago

When I add CONTENTFUL_HOST to my env vars, I get the following error:

Accessing your Contentful space failed.
Try setting GATSBY_CONTENTFUL_OFFLINE=true to see if we can serve from cache.

Used options:
spaceId: "*********"
accessToken: "***************************************"
host: "preview.contentful.com"

If I remove CONTENTFUL_HOST it can access the space with no issues.

I set up my project using the setup script and I entered the Content Delivery API access token when it asked for it. However, in the contentful API settings there are two API tokens - delivery & preview. I am assuming that I'm getting this error because it needs to use the preview api token but there is nowhere to put the preview api token in the gatsby-config. There is only one spot for accessToken.