Skip to content

fix(tracing): autoSessionTracking not working on the server-side#466

Merged
rchl merged 4 commits intomainfrom
fix/server-tracing
Dec 13, 2022
Merged

fix(tracing): autoSessionTracking not working on the server-side#466
rchl merged 4 commits intomainfrom
fix/server-tracing

Conversation

@rchl
Copy link
Copy Markdown
Member

@rchl rchl commented Dec 12, 2022

While investigating tracing functionality, I've noticed some broken/non-ideal behavior.

  • Due to Sentry requestHandler being created from the render:setupMiddleware hook and Sentry being initialized from the build:compile hook (or ready in production), the tracing functionality did not get initialized properly on the server-side because request handler was created before Sentry was initialized. Sentry request handler logic requires that Sentry is initialized first.

    Created a proxy that uses dummy handler until Sentry is initialized, at which point it gets replaced with Sentry's own handler.

  • The build:compile and build:before hooks run once per each bundle (client, server, modern, ...) so during the development, related code would trigger multiple times which could lead to issues or handlers being registered more than once.

    Created callOnce function that executes passed callback only once to ensure that those run only once.

@codecov
Copy link
Copy Markdown

codecov bot commented Dec 12, 2022

Codecov Report

Merging #466 (f7021e6) into main (da81da4) will decrease coverage by 1.60%.
The diff coverage is 66.66%.

@@            Coverage Diff             @@
##             main     #466      +/-   ##
==========================================
- Coverage   70.83%   69.23%   -1.61%     
==========================================
  Files           1        1              
  Lines          48       52       +4     
  Branches       22       21       -1     
==========================================
+ Hits           34       36       +2     
- Misses         11       13       +2     
  Partials        3        3              
Impacted Files Coverage Δ
lib/module.js 69.23% <66.66%> (-1.61%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@rchl rchl merged commit 67851ba into main Dec 13, 2022
@rchl rchl deleted the fix/server-tracing branch December 13, 2022 08:13
rchl added a commit to LukasHirt/sentry-module that referenced this pull request Dec 13, 2022
* main:
  fix(tracing): autoSessionTracking not working on the server-side (nuxt-community#466)
  fix: incorrect option name in the warning message (nuxt-community#467)
  chore(deps): don't update node version
  chore(deps): enable lock file maintenance for docs
  chore(docs): add .nvmrc for netlify and local dev
  chore(docs): update all sub-dependencies
  chore(docs): always build
  fix(deps): update devdependency @sentry/webpack-plugin to ^1.20.0 (nuxt-community#451)
  chore(deps): update all non-major dependencies (nuxt-community#449)
  chore(docs): fix documentation deploying, maybe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant