LoginSignup
4
0

More than 3 years have passed since last update.

contentfulでTypeError: Expected parameter accessTokenが出た時の対処法

Last updated at Posted at 2021-01-18

nextJSとcontentfulでアウトプット作品を作ってる時に環境変数でアクセストークンを管理すると

TypeError: Expected parameter accessToken

このようなエラーが出て途方にくれました。
実際にstackoverflowでに同様な質問がされていましたが、解決法がなかったのでこちらで簡潔に書きたいと思います。

結論からしまして、環境変数を

NEXT_PUBLIC_CONTENTFUL_SPACE_ID=xxxx,
NEXT_PUBLIC_CONTENTFUL_ACCESS_TOKEN=xxx,

nextJSでは.envの環境変数名.env.localに統一しないといけなかったり、
変数名の先頭にはNEXT_PUBLIC_を付け加えないといけないので注意が必要です。

4
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
0