Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
1a5a9e13
Unverified
Commit
1a5a9e13
authored
Aug 08, 2026
by
David Alexandru Ilie
Committed by
GitHub
Aug 08, 2026
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Document route handler prerender interruptions
parent
dce1ce2a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
1 deletion
+40
-1
migrating-to-cache-components.mdx
docs/01-app/02-guides/migrating-to-cache-components.mdx
+40
-1
No files found.
docs/01-app/02-guides/migrating-to-cache-components.mdx
View file @
1a5a9e13
...
@@ -828,7 +828,46 @@ async function getProducts() {
...
@@ -828,7 +828,46 @@ async function getProducts() {
}
}
```
```
>
**
Good
to
know
:**
Reading
uncached
or
runtime
data
in
a
`GET`
handler
bails
out
of
prerendering
by
**
throwing
**.
A
`try/catch`
you
already
have
around
other
operations
will
catch
that
bail
-
out
.
If
the
`catch`
block
logs
the
error
,
it
adds
noise
to
the
build
output
.
Set
`experimental.hideLogsAfterAbort: true`
to
hide
logs
emitted
after
a
bail
-
out
.
Reading
uncached
or
runtime
data
in
a
`GET`
handler
interrupts
prerendering
by
**
throwing
**.
A
broad
`try/catch`
around
other
operations
will
also
catch
this
framework
-
controlled
exception
.
If
the
`catch`
block
handles
application
errors
,
call
[
`unstable_rethrow`
](
/
docs
/
app
/
api
-
reference
/
functions
/
unstable_rethrow
)
first
so
Next
.
js
can
stop
prerendering
before
your
error
handling
runs
:
```ts filename="app/api/products/route.ts" switcher highlight={11}
import { unstable_rethrow } from 'next/navigation'
import type { NextRequest } from 'next/server'
export async function GET(request: NextRequest) {
try {
const id = request.nextUrl.searchParams.get('id')
const product = await getProduct(id)
return Response.json(product)
} catch (error) {
unstable_rethrow(error)
console.error(error)
return Response.json({ error: 'Failed to load product' }, { status: 500 })
}
}
```
```js filename="app/api/products/route.js" switcher highlight={10}
import { unstable_rethrow } from 'next/navigation'
export async function GET(request) {
try {
const id = request.nextUrl.searchParams.get('id')
const product = await getProduct(id)
return Response.json(product)
} catch (error) {
unstable_rethrow(error)
console.error(error)
return Response.json({ error: 'Failed to load product' }, { status: 500 })
}
}
```
`unstable_rethrow`
preserves
Next
.
js
control
flow
.
The
`experimental.hideLogsAfterAbort: true`
option
only
hides
logs
emitted
after
a
prerender
has
already
been
aborted
;
it
does
not
replace
rethrowing
framework
-
controlled
exceptions
.
## `generateMetadata` and `generateViewport`
## `generateMetadata` and `generateViewport`
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment