Skip to content

Auto-wrapping not working for Next.js Dynamic Routes #8442

Closed as not planned
Closed as not planned
@adeelejaz

Description

@adeelejaz

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/nextjs

SDK Version

7.57.0

Framework Version

7.57.0

Link to Sentry event

No response

SDK Setup

Sentry.init({
  environment: process.env.NEXT_PUBLIC_SITE_URL === "https://[..]" ? "production" : "development",
  dsn: SENTRY_DSN || "[..]",
  includeLocalVariables: true,
  tracesSampleRate: 0.2,
});

Steps to Reproduce

  1. Add a dynamic route when working with the Next.js 13 app directory e.g. app/checkout/[step]/page.jsx
  2. Get a warning during build.

Expected Result

Auto-wrapping to work

Actual Result

[@sentry/nextjs] Could not instrument /[..]/app/checkout/[step]/page.jsx. An error occurred while auto-wrapping:
SyntaxError: Unexpected token (14:55) in __SENTRY_WRAPPING_TARGET_FILE__.cjs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Package: nextjsIssues related to the Sentry Nextjs SDK

    Type

    No type

    Projects

    Status

    Waiting for: Product Owner

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions