Open ChrisManganaro opened 2 years ago
The error happens when trying to set the sitecoreContext
to context.context
on the wrapped component
https://github.com/Sitecore/jss/blob/dev/packages/sitecore-jss-react/src/enhancers/withSitecoreContext.tsx#L35
We also noticed that this only seemed to be an issue on SSR pages on first load.
At build time, pages using getStaticProps
build and work fine. E.g. we build a static 404 page and were able to access localhost:3000/404
just fine and were able to navigate around the site fine as well. However, loading an SSR'd page or refreshing a previously loaded page it would cause context
to be undefined
despite it being set on the provider just fine.
We also believe https://github.com/Sitecore/jss/pull/1041 would fix the issue we are seeing, but likely not the underlying bug of the context
being undefined
.
If #1041 is successful, would it be possible to get a patch release on v19 and v20 please?
withSitecoreContext
related issue I added to the backlog, we will triage that
about #1041 - hotfix will be released
Hi @pzi @ChrisManganaro - We investigated a similar (withSitecoreContext
HOC) issue and we narrowed it down to what appears to be a bug introduced in Next.js version 12.1.6. The fix is to downgrade to the previous version (i.e. npm i next@12.1.5
). Can you confirm if this resolves your issue as well?
cc @illiakovalenko @sc-addypathania
Description
With using
withSitecoreContext
HOC, pages built using SSR return 500 due to context being undefined - in production mode. In testing this issue, I have only be able to reproduce when running the app in production mode locallyExpected behavior
Pages load normally
Steps To Reproduce
https://github.com/ChrisManganaro/sitecore-nextjs-ssr
- this was started with the next sample appnpm i
npm run start:production
Your Environment