next-translate
next-translate copied to clipboard
Custom _error.tsx that uses getInitialProps
Hi,
I have a troublesome issue. Not sure this is a bug per say and it might not even be related to your library - bear with me for that.
We use your library in conjunction with sentry ( following implementation from next-js repo example - this makes use of Error.getInitialProps
in _error.tsx
page)
It works well when deploying on Vercel / building locally but it fails invariantly when deploying on CircleCi. The culprit is next build
where I get
Error occurred prerendering page "/404". Read more: https://err.sh/next.js/prerender-error
Export encountered errors on following paths: /404 /404.html
This seems to come from a conflict between getInitialProps
and getStaticProps
where the 404 SSG conflicts with
the getInitialProps
from _error.tsx
.
I thought it was related to the 404 page being SSG through your library therefore I tried to :
- remove the 404 page purely and simply from the app relying on Next default one - didn't change anything
- remove your webpack loader to add manually the fetching method on the pages, trying to avoid any
getStaticProps
on the 404 - didn't change anything neither.
As soon I SSR the 404 (which happens because of getInitialProps
in _error.tsx
) my build fails on CI.
I cannot really share the repo as its a private one with the NDA - will appreciate any help on this,
Thanks in advance
Did you find a possible fix for this issue in the end?