getEntries is not a function

I’m using Nuxt to create a blog and I’m using the code from https://github.com/contentful/blog-in-5-minutes/blob/master/pages/blog/_slug.vue.

I’m using this to get posts:

asyncData({ env, params }) {
    return client
      .getEntries({
        content_type: env.CTF_BLOG_POST_TYPE_ID,
        order: '-sys.createdAt'
      })
      .then(entries => {
        return {
          posts: entries.items
        }
      })
  }

There error message I’m getting is _plugins_contentful__WEBPACK_IMPORTED_MODULE_0___default.a.getEntries is not a function.

Environment

  • Language Version: v10.15.1
  • Package Manager Version: yarn v.1.13.0
  • Operating System: Darwin NSA.local 17.7.0 Darwin Kernel Version 17.7.0: Thu Jun 21 22:53:14 PDT 2018; root:xnu-4570.71.2~1/RELEASE_X86_64 x86_64