Errors in generateMetadata are not handled by error.tsx #49925
Replies: 4 comments 6 replies
-
|
This really feels like a bug in Next.js. |
Beta Was this translation helpful? Give feedback.
-
|
Hi @codinginflow, To catch those errors you you need to add a 'global-error.tsx' to your app directory. You can find more details in the nextjs docs here. Hope this helps. Kind regards, Arjen |
Beta Was this translation helpful? Give feedback.
-
|
I have a similar issue with data fetching and calling I have worked around it by catching errors in However, I do agree that it seems more intuitive for |
Beta Was this translation helpful? Give feedback.
-
|
I'm now on Nextjs 15.0.0-canary.104 and this appears to be an ongoing issue. Errors from within the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Often you need to fetch some data in
generateMetadata:The problem: The error we rethrow in the
catchblock doesn't lead to theerror.tsxpage. Instead, we get to a default full-screen error page that doesn't include any elements of ourlayout.tsx.How am I supposed to make network requests in
generateMetadataif errors are not handled properly?Beta Was this translation helpful? Give feedback.
All reactions