errors/ppr-caught-error.mdx
When Partial Prerendering (PPR) is enabled, using APIs that opt into Dynamic Rendering like cookies, headers, or fetch (such as with cache: 'no-store' or revalidate: 0) will cause React to throw a special error object to know which part of the page cannot be statically generated - while still letting the rest of it be partially static. If you catch this error, it is not safe for us to generate any static data, and your build will fail.
try/catch block.unstable_noStore() before the try/catch.import { unstable_noStore } from 'next/cache'
async function fetchData() {
unstable_noStore() // opt out before we even get to the try/catch
try {
const response = await fetch(url);
...
} catch (x) {
...
}
}