prismicio / prismic-react

React components and hooks to fetch and present Prismic content
https://prismic.io/docs/technologies/homepage-reactjs
Apache License 2.0
154 stars 40 forks source link

Prismic preview crashing in Next.js production with 500 error #108

Closed levimykel closed 2 years ago

levimykel commented 2 years ago

Versions

Reproduction

I just updated from prismic-reactjs to @prismicio/react for the Prismic documentation website. Everything works as expected in local development, including previews. When deployed, however, everything crashes with a 500 error when I run a Prismic preview (everything works as expected when not in preview mode).

I'm getting the following error:

[GET] /docs/technologies/query-the-api-dotnet
2022-01-12T15:19:02.927Z
ERROR   TypeError: React.createContext is not a function
    at file:///var/task/node_modules/@prismicio/react/dist/index.js:7:30
    at ModuleJob.run (internal/modules/esm/module_job.js:145:37)
    at async Loader.import (internal/modules/esm/loader.js:182:24) {
  page: '/technologies/query-the-api-dotnet'
}
Error: Runtime exited with error: exit status 1
Runtime.ExitError
angeloashmore commented 2 years ago

Hey @levimykel, I tried it on my side, both locally and in production (in my own separate account), and was unable to get this error.

Is it possible to redeploy the app on Vercel with a cleaned cache?

levimykel commented 2 years ago

@angeloashmore Is there a specific way that you know of to clean a cache on Vercel? It seemed to me that the cache is cleared automatically anytime a new deployment is launched.

levimykel commented 2 years ago

@angeloashmore The update is working. Thanks for looking into it!