-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Together with @sentry/nextjs
this will break production builds
#35
Comments
Hi, @reckter thanks for reporting this! |
@xeoneux Hi, Sentry SDK maintainer here. Thank you for taking a look at this! I am not entirely sure whether your fix will work since your wrapper still doesn't return The problematic line is: Line 106 in ca4ac4a
The Next.js docs state that if you have a I propose the following change: - const appProps = App.getInitialProps ? await App.getInitialProps(appContext) : {}
+ import NextApp from "next/app"
+ const appProps = App.getInitialProps ? await App.getInitialProps(appContext) : await NextApp.getInitialProps(appContext) We should probably also be a bit more defensive in what data types we assert in the SDK but I still recommend you go through with this change just to be in line with the Next.js docs. |
Ah, that makes sense, thanks for the explanation @lforst! I have updated the lib with the change 👍 |
Tested with |
See getsentry/sentry-javascript#5906
Sentry expects the
getInitialProps
function to return{ pageProps: unknown}
to set something onpageProps
.Currently this HOC, will return
{initialProps: {pageProps: unknown }, ...}
.Which will cause Sentry to run into an runtime type error.
Our current workaround is:
I think ideally this should be fixed in the library directly, but it could theoretically break some apps, if they rely on this current behavior.
If desired, I might be able to come up with a fix myself (if my time permits 😓), but wanted to gauge feedback first.
The text was updated successfully, but these errors were encountered: