Update Sentry Example Page (auto-added in CLI) to work with cache components

Open Beginner friendly
#24,200 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
75/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
nextjs, typescript
Domain
api, cli

Research direction

Start with the generated app/api/sentry-example-api/route.ts and reproduce the failure with nextConfig.cacheComponents enabled. Then find the CLI template that creates this example page and verify the generated route builds successfully without the reported route-segment configuration error.

Written by the indexing model from the issue text.

Description

javascript

dymanic is not allowed with cache components and currently our added example page throws this error:

./app/api/sentry-example-api/route.ts:2:14
Error: Route segment config "dynamic" is not compatible with `nextConfig.cacheComponents`. Please remove it.
  1 | import * as Sentry from "@sentry/nextjs";
> 2 | export const dynamic = "force-dynamic";
    |              ^^^^^^^
  3 |
  4 | class SentryExampleAPIError extends Error {
  5 |   constructor(message: string | undefined) {

Ecmascript file had an error


    at <unknown> (./app/api/sentry-example-api/route.ts:2:14)
[ELIFECYCLE] Command failed with exit code 1.
Dominant language
TypeScript
Stars
8.7k
Forks
1.9k
Avg merge
1d 17h
Merged PRs (30d)
521

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from getsentry/sentry-javascript

All issues in getsentry/sentry-javascript

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.