Gatsby: [gatsby-source-contentful] TypeError: Expected parameter accessToken

Created on 22 Jan 2019  路  3Comments  路  Source: gatsbyjs/gatsby

Summary

I created a new Gatsby 2 project. Then created a new space in Contentful, added content model and content with just 2 short text fields. I went back to my project, added the gatsby-source-contentful plugin in my gatsby-config.js. I tried to run the GraphQL in my web local host server and the query couldn't get the data I entered in Contentful.

The error is TypeError: Expected parameter accessToken.

However, I did enter both my spaceID and accessToken. I even emptied my cache by rm -rf .cache and did npm i multiple times. Can't just get rid of this nonsense error. Not sure if the version of the plugin is clashing with something.

Relevant information

My website that is live is based on Gatsby 1. So my global gatsby cli is still v1 so I'm afraid to update it to v2.

Environment (if relevant)

System:
OS: macOS 10.14.2
CPU: x64 Intel(R) Core(TM) i5-7267U CPU @ 3.10GHz
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 8.11.3 - /usr/local/bin/node
npm: 6.6.0 - /usr/local/bin/npm
Browsers:
Chrome: 71.0.3578.98
Safari: 12.0.2
npmPackages:
gatsby: ^2.0.76 => 2.0.76
gatsby-image: ^2.0.20 => 2.0.25
gatsby-plugin-manifest: ^2.0.9 => 2.0.12
gatsby-plugin-offline: ^2.0.16 => 2.0.20
gatsby-plugin-react-helmet: ^3.0.2 => 3.0.5
gatsby-plugin-sharp: ^2.0.14 => 2.0.16
gatsby-source-contentful: ^2.0.26 => 2.0.26
gatsby-source-filesystem: ^2.0.8 => 2.0.12
gatsby-transformer-sharp: ^2.1.8 => 2.1.9
npmGlobalPackages:
gatsby-cli: 1.1.58

File contents (if changed)

gatsby-config.js:

    {
      resolve: `gatsby-source-contentful`,
      option: {
        spaceId: 'mySpaceId',
        accessToken: `myAccessTokenn`
      }
    }

package.json:

"gatsby-source-contentful": "^2.0.26"
"styled-components": "^4.1.3"

gatsby-node.js: N/A
gatsby-browser.js: N/A
gatsby-ssr.js: N/A

question or discussion

Most helpful comment

OMG! For real? I feel dumb now. I compared so many times visually. It's good to have a second pair of eyes. Thanks a lot!

All 3 comments

@Dara-To option needs to be options in gatsby-config.js

OMG! For real? I feel dumb now. I compared so many times visually. It's good to have a second pair of eyes. Thanks a lot!

@Dara-To Happens to the best of us! You鈥檙e welcome and happy building with Gatsby 馃檪

Was this page helpful?
0 / 5 - 0 ratings