You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Next] Ensure the wizard cleans up old configuration file when creating new one #930
When the wizard adds the new instrumentation-client.ts file, it does not remove the old sentry.client.config.ts, which during dogfooding broke instrumentation even for errors. Our wizard should make sure that these changes do not break instrumentation and clean up unused / deprecated files (even if just by renaming them to [name]-deprecated.[suffix].
Reproduction:
Setup sentry using wizard in Next.js project
Setup sourcemaps using wizard in Next.js project
Actual Outcome:
The project contains both instrumentation-client.ts and sentry.client.config.ts
Sentry seems to crash when both instrumentation files are found (example)
As an effect of this, Sentry does not capture exceptions when this happens
Expected Outcome:
I only have instrumentation-client.ts, or both files, but instrumentation is not broken by this.
Do we really want to handle this in the wizard? Applying migrations is outside the scope of what the wizard should usually do. Generally, it should set up Sentry in projects w/o a pre-existing Sentry setup. We do have checks for previously existing Sentry code in most flows but these are mainly for defensiveness, but not to actively identify old setup and replace it with a more up to date version.
I don't want to block this but to me this rather looks like the wizard was used with wrong expectations.
If we want to make an exception for NextJS then by all means :) Though generally I'd rather not want this to become the norm (I'm already getting flashbacks of @sentry/migr8 😅 ).
@Lms24 Just from a usage perspective, I set up Sentry using the wizard, and then added sourcemaps using the wizard, and afterwards my instrumentation was completely broken. Not sure what we usually do, but this seems like behaviour that really interferes with the UX - we should at least tell users to remove the old file otherwise?
I set up Sentry using the wizard, and then added sourcemaps using the wizard
Ah thanks for sharing the context! I'm not sure if there were other convos around this and I see, Luca is assigned so ignore me (especially if it turns out that this is a bug) :D
All good - just thought it was important to clear this up :) I think it is a bug, but let's see. I'll add the context to the issue description to make it clearer!
This particular issue arose because two separate wizard runs were conducted right as we migrated from sentry.client.config.ts to instrumentation-client.ts
I think we can resolve this by warning about the double initialization.
In general it is not a huge deal because this particular issue was a humongous edge case. I am surprised that there was even a singular person running into this.
Activity
Lms24 commentedon Mar 28, 2025
Do we really want to handle this in the wizard? Applying migrations is outside the scope of what the wizard should usually do. Generally, it should set up Sentry in projects w/o a pre-existing Sentry setup. We do have checks for previously existing Sentry code in most flows but these are mainly for defensiveness, but not to actively identify old setup and replace it with a more up to date version.
I don't want to block this but to me this rather looks like the wizard was used with wrong expectations.
If we want to make an exception for NextJS then by all means :) Though generally I'd rather not want this to become the norm (I'm already getting flashbacks of
@sentry/migr8😅 ).shellmayr commentedon Mar 28, 2025
@Lms24 Just from a usage perspective, I set up Sentry using the wizard, and then added sourcemaps using the wizard, and afterwards my instrumentation was completely broken. Not sure what we usually do, but this seems like behaviour that really interferes with the UX - we should at least tell users to remove the old file otherwise?
Lms24 commentedon Mar 28, 2025
Ah thanks for sharing the context! I'm not sure if there were other convos around this and I see, Luca is assigned so ignore me (especially if it turns out that this is a bug) :D
shellmayr commentedon Mar 28, 2025
All good - just thought it was important to clear this up :) I think it is a bug, but let's see. I'll add the context to the issue description to make it clearer!
lforst commentedon Apr 3, 2025
sentry.client.config.tstoinstrumentation-client.tsfeat(nextjs): Warn when client was initialized more than once (#15971)