-
Notifications
You must be signed in to change notification settings - Fork 27.2k
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
fetchNextData
error handling fails with TypeError: Attempted to assign to readonly property.
#11608
Comments
Have you been able to correct this bug yet? I have encountered the same error. (only in production mode) When I switch from getStaticProps export async function getStaticProps() {
const page = (await backend.client.pages().slug('test')) || null
return { props: { page } }
} to getInitialProps the error does not occur. static async getInitialProps() {
const page = (await backend.client.pages().slug('test')) || null
return { page }
} But unfortunately this is no solution for me, because I need all pages as static pages. |
I actually switched to |
Same problem here, ended up using the normal html anchor instead of the Link from 'next/link' and no problem. I received the same error as above, PAGE_LOAD_ERROR. Redirect on getServerSideProps did not redirect, initial error showed up as "attempt to assign to readonly type... native code" I was able to make a basic repro. Please see context below for info. edit: some additional context: I am using the next preview version of Next.js (^9.3.7-canary.17) as of now. I enabled React strict mode from the config. Strangely, the error only happens in Safari. In Chrome, the route works fine, Firefox sees a white page for a second but no error thrown. As also mentioned above, the author of this issue noticed the error in an iOS simulator. 2nd edit: On Firefox, when clicking the link to My Account from the repro above, it reloads the page once. Clicking it again will go to the redirected route though. Environment: macOS Catalina Beta 10.15.5 Node v12.16.3 |
Oh, I forgot to answer that. I have solved the problem in the meantime - I have executed Next in a different folder. ( |
I can confirm that this is no longer an issue with the latest canary, 9.4.3-canary.1 Thank you! |
Having the same fatal error on Safari/Edge with [email protected] when:
this ultimately triggers the (Exist in dev and prod) |
Ok so for me this was related to this issue : #12409 |
Safari now treats Error#code as a readonly property, which means we can no longer override it. This PR replaces the now-reserved property with a Symbol descriptor. It also adds new production tests for this behavior to ensure they're ran against all major browsers (Safari included) in our E2E CI. --- Fixes vercel#11608
This was fixed in |
I had this problem in |
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Bug report
Describe the bug
I woke up this morning to find that some of our site's CTA links (using 'next/link') were broken in mobile browsers, displaying "An unexpected error has occurred" to the user. The only thing I could find in Rollbar was this error:
TypeError: Attempted to assign to readonly property.
.Testing locally with iOS Simulator, I traced it to this line in
.next/static/development/pages/_app.js
:Here is the full function where the error is occurring:
The page I am attempting to transition to is using
getServerSideProps
to check the user's a/b test cookie and redirect them based on the result:This issue never occurs when navigating to the page directly or using a standard anchor tag - only when using 'next/link'.
Here is the link for reference:
To Reproduce
Obviously, this is a sort of complicated example, and I'm not exactly sure what's causing the initial error. Let me know if you need more information, and I can try to create an example repo when I'm able to.
Expected behavior
It would seem there are 2 issues here. One is that an error is occurring during when clicking a
next/link
to a page usinggetServerSideProps
to redirect. The other is that during the handling of this error, another error is thrown when attempting to set the value oferr.code
.I would expect to get information about what the error is, if it's something caused by my code, but we never make it that far.
Screenshots
If applicable, add screenshots to help explain your problem.
System information
Additional context
Thank you! Again, happy to provide any more detail necessary.
The text was updated successfully, but these errors were encountered: