-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[@sentry/svelte] Component tracking with withSentryConfig + webpack breaks Svelte 5 runes mode #15259
Comments
Hey @scottohara thanks for reporting this and also thanks for the great reproduction! I think this is a general Svelte 5 (Runes mode) incompatibility with our component tracking feature. I looked briefly into a way to still track component updates in Runes mode but couldn't come up with something simple. Therefore, for version 8 of our SDK, I opened #15262 to at least degrade gracefully and avoid breaking the application. You can completely disable update tracking by setting withSentryConfig({/*your svelte config*/}, { componentTracking: { trackUpdates: false } }) or, if you use trackComponent({trackUpdates: false}); For posterity, If we wanted to get this working properly in all Svelte versions, we'd need to be smarter in a couple of ways:
In v9 of the SDK, I'll disable
|
I merged #15262. It will be included in the next release. Thanks for reporting! |
The fix was released in 8.55.0 (as well as 9.0.0). Closing this issue - let me know if the problem still persists! |
Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/svelte
SDK Version
8.52.1
Framework Version
Svelte v5.19.6
Link to Sentry event
No response
Reproduction Example/SDK Setup
Repro: /~https://github.com/scottohara/svelte5-withsentryconfig-bug
The issue occurs when the following is true:
let now = $state(new Date().toString());
)withSentryConfig()
to enable component tracking, e.g.Steps to Reproduce
Setup
git clone /~https://github.com/scottohara/svelte5-withsentryconfig-bug.git cd svelte5-withsentryconfig-bug npm install webpack
Verify working
At this point, open the file
dist/index.html
in your browser. You should see a message like:This confirms that app builds & runs successfully without component tracking.
Enable component tracking
The
WITH_SENTRY=1
environment variable instructs the webpack config to wrap the svelte-loader options inwithSentryConfig()
.Now open (or refresh) the
dist/index.html
page in your browser. You should now see a blank page, and in the browser console the following error:When caught, the error message is in fact:
Expected Result
When component tracking is enabled (in the example repo, by passing
WITH_SENTRY=1
to the webpack command; the app should not error and should display the same as when component tracking is disabled.Actual Result
With component tracking disabled
A successful render, and no console errors:
With component tracking enabled
A failed render (blank page), and the Svelte legacy error:
Why does this happen?
I believe that the root cause is the code in
@sentry/svelte
that does component tracking uses thebeforeUpdate(...)
lifecycle method.This lifecycle method is deprecated in Svelte 5.
It may be the case that
withSentryConfig()
was never designed to be used with webpack + svelte-loader (as it doesn't seem to have any issues when used in a Vite-based Svelte5 project).However prior to Svelte 5 and runes mode, using
withSentryConfig
in webpack + svelte-loader in this way did not throw any errors.The text was updated successfully, but these errors were encountered: