[gatsby-source-contentful] Gatsby fails to connect to other Contentful environments than master
See original GitHub issueDescription
For gatsby-source-contentful
version 2.1.45 and newer, when trying to access content from a Contentful space in another environment than master
(for instance development
) with an access token that is only allowed for this environment, but not also for master
, Gatsby fails to connect with the message ‘Accessing your Contentful space failed.’.
It connects successfully if the access token also allows access to the master
environment, but I need to have individual access tokens for each environment.
This behavior only occurs since gatsby-source-contentful
version 2.1.45, including the most recent version 2.3.46. For older versions up to 2.1.44, it works fine.
Steps to reproduce
- create Contentful space with two environments, e.g.
master
anddevelopment
- create an access token with only access to the
development
environment - install the most recent versions of
gatsby
andgatsby-source-contentful
- setup
gatsby-source-contentful
to connect to thedevelopment
environment with the access token - run
gatsby develop
Expected result
Gatsby runs correctly.
Actual result
With gatsby-source-contentful
version 2.1.45 and newer, it crashes with this error message:
Accessing your Contentful space failed.
Try setting GATSBY_CONTENTFUL_OFFLINE=true to see if we can serve from cache.
Used options:
spaceId: "*********dbd"
accessToken: "***************************************SnLg"
environment: "development"
host: "cdn.contentful.com"
downloadLocal (default value): false
localeFilter (default value): [Function]
forceFullSync (default value): false
pageLimit (default value): 100
useNameForId (default value): true
not finished source and transform nodes - 0.422s
error Command failed with exit code 1.
Environment
System:
OS: macOS Mojave 10.14.6
CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 12.16.2 - /usr/local/bin/node
Yarn: 1.22.4 - /usr/local/bin/yarn
npm: 6.14.4 - /usr/local/bin/npm
Languages:
Python: 2.7.16 - /usr/bin/python
Browsers:
Chrome: 80.0.3987.132
Firefox: 79.0
Safari: 13.1.2
npmPackages:
gatsby: ^2.24.60 => 2.24.60
gatsby-plugin-manifest: ^2.0.19 => 2.3.3
gatsby-plugin-meta-redirect: ^1.1.1 => 1.1.1
gatsby-plugin-react-helmet: ^3.0.7 => 3.2.1
gatsby-plugin-react-svg: ^2.1.1 => 2.1.2
gatsby-plugin-sass: ^2.0.10 => 2.2.1
gatsby-source-contentful: ^2.3.46 => 2.3.46
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (1 by maintainers)
Top GitHub Comments
I found an internal ticket confirming this issue.
Looks like for now your access token needs to have access to master environment, even when content is loaded from a different environment.
I will keep u posted.
This was fixed in
v4.7.0
. Closing