sentry-javascript: Upgrading to 7.91.0 breaks applications using @sentry/next `transaction.end is not a function`

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.91.0

Framework Version

13.3.4

Link to Sentry event

No response

SDK Setup

const config = {
  dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
  release: process.env.NEXT_PUBLIC_SENTRY_RELEASE,
  environment: publicRuntimeConfig.sentryEnvironment,
};

Sentry.init(config);

Steps to Reproduce

Upgrade to 7.91.0 from 7.88.0

Expected Result

Application continues to work as it has.

Actual Result

Application crashes with transaction.end is not a function.

image

This occurred across all our routes, example above.

Reverting fixes.

About this issue

  • Original URL
  • State: closed
  • Created 6 months ago
  • Reactions: 2
  • Comments: 28 (10 by maintainers)

Most upvoted comments

@PierrickP make sure your sentry library versions resolved via transitive dependencies are all the same. I believe @sentry/tracing will be the problem. npm why @sentry/tracing will give you info on it.

This is the issue I was describing above, where upgrading the main sentry library doesn’t trigger an update of dependencies and causes runtime errors.

on new installation of sentry 7.101.1 i followed the instructions and used the npx thing (until it stuck because i don’t have yarn) i am getting this error which not allow my sveltekit application to work

An error occurred on the server side: TypeError: activeSpan.end is not a function
    at C:\Users\babay\source\repos\1.01\node_modules\@sentry\sveltekit\node_modules\@sentry\core\cjs\tracing\trace.js:98:40
    at maybeHandlePromiseRejection (C:\Users\babay\source\repos\1.01\node_modules\@sentry\sveltekit\node_modules\@sentry\core\cjs\utils\handleCallbackErrors.js:62:3)
    at Object.handleCallbackErrors (C:\Users\babay\source\repos\1.01\node_modules\@sentry\sveltekit\node_modules\@sentry\core\cjs\utils\handleCallbackErrors.js:33:10)
    at C:\Users\babay\source\repos\1.01\node_modules\@sentry\sveltekit\node_modules\@sentry\core\cjs\tracing\trace.js:87:35
    at Hub.withScope (C:\Users\babay\source\repos\1.01\node_modules\@sentry\node\node_modules\@sentry\core\cjs\hub.js:185:28)
    at Object.withScope (C:\Users\babay\source\repos\1.01\node_modules\@sentry\sveltekit\node_modules\@sentry\core\cjs\exports.js:170:20)
    at C:\Users\babay\source\repos\1.01\node_modules\@sentry\sveltekit\node_modules\@sentry\core\cjs\tracing\trace.js:75:22
    at C:\Users\babay\source\repos\1.01\node_modules\@sentry\node\cjs\async\hooks.js:42:14
    at AsyncLocalStorage.run (node:async_hooks:327:14)
    at Object.runWithAsyncContext (C:\Users\babay\source\repos\1.01\node_modules\@sentry\node\cjs\async\hooks.js:41:25)

@Cluster2a Thanks for sharing this. To me, this screams like either a caching issue or a stale dependency like I described. This is not something that is really fixable from our side I believe. If all the versions are aligned, like we require them to have, everything should work as expected.

To anybody stumbling onto this: Please first check your lockfile for diverging Sentry dependencies. Next, clear your node_modules, and package manager caches (like pnpm store), and reinstall your dependencies.

Doing this resolved the issue for me

@Cluster2a Thanks for sharing this. To me, this screams like either a caching issue or a stale dependency like I described. This is not something that is really fixable from our side I believe. If all the versions are aligned, like we require them to have, everything should work as expected.

To anybody stumbling onto this: Please first check your lockfile for diverging Sentry dependencies. Next, clear your node_modules, and package manager caches (like pnpm store), and reinstall your dependencies.

Ok, will stick on the outdated SDK. I don’t have a huge appetite to fix vendor problems on holidays. On Wed, Dec 27, 2023, at 5:39 AM, Luca Forstner wrote: Would you mind sharing a reproduction example so we can debug this further? I myself cannot replicate this behaviour. Thanks! — Reply to this email directly, view it on GitHub <#9981 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AATQYQ42QUYBIQ6FKT7M6WTYLQCGNAVCNFSM6AAAAABBDNEX5KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZQGIZDOMJUHE. You are receiving this because you were mentioned.Message ID: @.***>

I was unable to reproduce the error in a new project (also mentioned in https://github.com/getsentry/sentry-javascript/issues/9979).

I fixed the problem by running the following commands.

rm -r node_modules/ rm -r .pnpm-store/ rm -r .svelte-kit/ rm pnpm-lock.yaml

Something seems to be stuck after updating the dependencies.

@lforst, i just checked and I am able the reproduce the issue in my existing repo

  • install @sentry/sveltekit 7.90.0
  • restart the dev server (I am using docker)
  • run ncu -u && pnpm install -> update to 7.91.0
  • restart dev server
  • exception occurs
  • rm -r node_modules/ && rm -r .pnpm-store/ && rm -r .svelte-kit/ && rm pnpm-lock.yaml and restarting fixes the issue

Usually this way of updating a dependency (ncu -u && pnpm install) is not a problem at all - not sure what is causing this problem.

Got the same issue with @sentry/sveltekit 7.91.0. No other sentry-dependencies involved.

image