Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next.js Turbopack Support #8105

Open
Tracked by #85531
ryanolson-aumni opened this issue May 11, 2023 · 53 comments
Open
Tracked by #85531

Next.js Turbopack Support #8105

ryanolson-aumni opened this issue May 11, 2023 · 53 comments
Assignees
Labels
Package: nextjs Issues related to the Sentry Nextjs SDK Type: Improvement

Comments

@ryanolson-aumni
Copy link

ryanolson-aumni commented May 11, 2023

⚠️ This original post has been edited by @lforst to reflect the current status of Turbopack Support ⚠️

Important

This issue is tracking progress on Turbopack Support. If you find bugs or problems with the Sentry SDK in combination with Turbopack please open a separate issue. Thank you!

Problem Statement

Sentry should work in combination with Turbopack with all of its features.

Current Status (Last Update Apr 10, 2025)

Feature Support Notes
Next.js app compiles and runs without issues
Server-side instrumentation
Client-side instrumentation - Upgrade to SDK version 9.9.0 or greater
- Upgrade to Next.js canary 15.3.0-canary.8 or greater
- Add instrumentation-client.ts file with Sentry.init() call. (sentry.client.config.ts can be replaced with instrumentation-client.ts. It serves the same purpose.)
Release Injection - Upgrade SDK to version 9.11.0
Source Maps - Needs runAfterProductionCompile hook implemented in Next.js
- Needs way to inject debug IDs into bundles implemented in Next.js
React Component Name Annotations - Needs way to transform code in Next.js
- Will likely not be possible for the forseeable future
@smeubank
Copy link
Member

Hi @ryanolson-aumni

We are also eager to add support here!

We have 2 plugin repos to add support for webpack, esbuild, rollup, and vite. The latter 3 we support via an opensource project where we'd love to see support so we could potentially adopt it via our usage of their adapters. Upvote the issue there as well. Although I do not think it is on their immediate radar either. unjs/unplugin#302

https://github.com/getsentry/sentry-webpack-plugin

https://github.com/getsentry/sentry-javascript-bundler-plugins

@mdugue
Copy link

mdugue commented Sep 18, 2023

any news on this?

@lforst
Copy link
Member

lforst commented Sep 21, 2023

@mdugue We'll tackle turbopack when it becomes somewhat stable.

@smeubank
Copy link
Member

any news on this?

Fwiw I would also encourage you to upvote and comment on this issue which wr could also use to provide support similar to webpack, vite, esbuild and rollup

unjs/unplugin#302

@lforst
Copy link
Member

lforst commented Oct 18, 2023

Update

As of now, we cannot transfer the functionality we currently have in the SDK to Turbopack:

Turbopack loaders are not passed transpiled javascript, instead, they are passed the original user code. The SDK needs transpiled JS to properly be able to do transformations to modules. We could transpile the user code ourselves but that is fragile AF - so not an option.

As of now, the SDK will continue to work in production mode which is arguably more important, but we would like to support dev mode.

Branch with my experiments: #9295

@Stanzilla
Copy link

Update

As of now, we cannot transfer the functionality we currently have in the SDK to Turbopack:

Turbopack loaders are not passed transpiled javascript, instead, they are passed the original user code. The SDK needs transpiled JS to properly be able to do transformations to modules. We could transpile the user code ourselves but that is fragile AF - so not an option.

As of now, the SDK will continue to work in production mode which is arguably more important, but we would like to support dev mode.

Branch with my experiments: #9295

To clarify, does it work with Turbopack in production mode as-is or only with the changes in your branch?

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 Dec 14, 2023
@lforst
Copy link
Member

lforst commented Dec 15, 2023

@Stanzilla Turbopack will not work with the SDK (dev and prod). My branch does not contain any fixes or features, just experiments proving that things don't work.

@leerob
Copy link

leerob commented Feb 10, 2024

It's also worth noting that the initial Turbopack support is for next dev, which is only for your local environment. next build support will come later 🙏

@jmarbutt
Copy link

Is this why my dev mode crashes after every change in NextJS now? Anytime I make a change I get an error.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Mar 30, 2025
@lforst
Copy link
Member

lforst commented Mar 31, 2025

@jmarbutt In general: No, Sentry should not crash your dev mode in any case.

If you think otherwise, please create a separate issue with reproduction!

@jmarbutt
Copy link

Yeah it seems to only be happening when I am using turbo and sentry, if I disable turbo it works fine. I will see if I can get it to a more reproducible error.

@kachkaev
Copy link

kachkaev commented Apr 9, 2025

Next.js 10.3 got released today. This section in the blog post looks promising:

Ecosystem
We’re working with commonly used integrations like Sentry to make sure they’re compatible with next build --turbopack before the stable release. Please reach out to @leerob on X if you are a tool author who would like to work with us to ensure compatibility.

🤞

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Apr 9, 2025
@coderrshyam
Copy link

hey @calvinf Next.js15.3.0 just released today.

@wroughtec
Copy link

Just played with it this morning, might need to make sure the comment doesn't display or at least change it if is 15.3.0 🤣

 WARNING: You are using the Sentry SDK with Turbopack (`next build --turbo`). The Sentry SDK is compatible with Turbopack on Next.js version 15.3.0 or later. You are currently on 15.3.0. Please upgrade to a newer Next.js version to use the Sentry SDK with Turbopack. Note that as Turbopack is still experimental for production builds, some of the Sentry SDK features like source maps will not work. Follow this issue for progress on Sentry + Turbopack: https://github.com/getsentry/sentry-javascript/issues/8105.```

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Apr 10, 2025
@lforst
Copy link
Member

lforst commented Apr 10, 2025

@kachkaev @chargome Yup, we are on it as much as we can. Still dependent on a few Next.js changes. In general, if you upgrade the SDK you should have all the monitoring functionality - only sourcemaps will not work.

@wroughtec Good point. Will change that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: nextjs Issues related to the Sentry Nextjs SDK Type: Improvement
Projects
Status: No status
Development

No branches or pull requests