My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

Why can't Gatsby read my Contentful environment variables on Netlify?

Samuel Akintunde's photo
Samuel Akintunde
·Oct 15, 2018

So, I'm building my portfolio website and I'm pulling in my projects and blog stories from Contentful. In development, I use a .env file to save the Space ID and Access Token and it works once I use process.env.CONTENTFUL_SPACE_ID and process.env.CONTENTFUL_ACCESS_TOKEN(which is what I saved them as). I use the Build Environment Variables section on Netlify to save the Space ID and Access Token using the same names as in development. However, the build keeps failing with an error, "WebpackError: TypeError: Expected parameter accessToken".