Skip to content

Commit 1b8502c

Browse files
logaretmCopilot
andauthored
docs(nextjs): Document cache components limitations (#15899)
With more users adopting cache components and running into our current limitations with it, we have to document it for them with the possible workarounds. None of these are ideal, but the way cache components interferes with our core SDK behavior is not straightforward to fix and may need fundamental changes to our core SDK. For now I made sure we document the couple of wide cases that the issue appears in, and possible workarounds (more like compromises). --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent bbb9641 commit 1b8502c

File tree

4 files changed

+40
-0
lines changed

4 files changed

+40
-0
lines changed

docs/platforms/javascript/guides/nextjs/index.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ categories:
99
- server-node
1010
---
1111

12+
<PlatformContent includePath="nextjs-cache-components-limitations/alert" />
13+
1214
<PlatformContent includePath="llm-rules-platform" />
1315

1416
<PlatformContent includePath="getting-started-prerequisites" />
@@ -328,6 +330,8 @@ Learn more about [Logs configuration](/platforms/javascript/guides/nextjs/logs/)
328330

329331
</Expandable>
330332

333+
<PlatformContent includePath="nextjs-cache-components-limitations/section" />
334+
331335
## Next Steps
332336

333337
You've successfully integrated Sentry into your Next.js application! Here's what to explore next:

docs/platforms/javascript/guides/nextjs/manual-setup/index.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ categories:
1515
installer](/platforms/javascript/guides/nextjs).
1616
</Alert>
1717

18+
<PlatformContent includePath="nextjs-cache-components-limitations/alert" />
19+
1820
This guide covers manual setup for **Next.js 15+ with Turbopack and App Router**. For other setups, see:
1921

2022
- [Pages Router Setup](/platforms/javascript/guides/nextjs/manual-setup/pages-router/) - For applications using the Pages Router
@@ -587,6 +589,10 @@ If your application uses both the App Router and Pages Router:
587589
the appropriate instrumentation.
588590
</Alert>
589591

592+
<h2 data-no-number>Known Limitations</h2>
593+
594+
<PlatformContent includePath="nextjs-cache-components-limitations/section" />
595+
590596
<h2 data-no-number>Next Steps</h2>
591597

592598
You've successfully integrated Sentry into your Next.js application! Here's what to explore next:
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<Alert level="warning" title="Cache Components Limitations">
2+
3+
If you're using Next.js [Cache Components](https://nextjs.org/docs/app/getting-started/cache-components), there are known compatibility issues with server-side tracing. See [Cache Components Limitations](#cache-components-limitations) for details and workarounds.
4+
5+
</Alert>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
### Cache Components Limitations
2+
3+
If you're using Next.js [Cache Components](https://nextjs.org/docs/app/getting-started/cache-components), you may encounter errors like:
4+
5+
```
6+
Accessing random cryptographic values synchronously in a Server Component requires reading one of these data sources first...
7+
```
8+
9+
#### Turbopack with `generateMetadata`
10+
11+
Using `generateMetadata` in page components with Turbopack and the Sentry SDK is currently not supported. ([Tracking issue](https://github.com/getsentry/sentry-javascript/issues/18392))
12+
13+
**Workarounds:**
14+
15+
- Remove `generateMetadata` from affected page components
16+
- Disable server-side tracing by removing or renaming your `instrumentation.ts` file
17+
18+
#### Webpack with Cache Components
19+
20+
Cache Components are not supported when using webpack. ([Tracking issue](https://github.com/getsentry/sentry-javascript/issues/18340))
21+
22+
**Workarounds:**
23+
24+
- Switch to Turbopack (note the `generateMetadata` limitation above)
25+
- Disable server-side tracing by removing or renaming your `instrumentation.ts` file

0 commit comments

Comments
 (0)