Skip to content

(plugin-server-session): delay initialization until first use#2642

Merged
hamudi-ahmed merged 2 commits intonextfrom
PLAT-15388/plugin-server-session-lazy-init
Dec 16, 2025
Merged

(plugin-server-session): delay initialization until first use#2642
hamudi-ahmed merged 2 commits intonextfrom
PLAT-15388/plugin-server-session-lazy-init

Conversation

@hamudi-ahmed
Copy link
Copy Markdown
Contributor

Goal

Serverless node plugins such as AWS Lambda (and the incoming Cloudflare Workers plugin) use plugin-browser-session and not plugin-server-session, but because plugin-server-session is bundled with the node notifier as an internal plugin, it's session tracking is still initialized on start, before any of the external plugins are loaded.

This causes problems in some environments like Cloudflare Workers, and results in unnecessary work and leaked timers, since the session delegate is replaced when those plugins are loaded.

Design

This PR fixes the issue by delaying the session tracker initialization until startSession is actually called - this preserves the existing behaviour for 'regular' node environments while allowing the serverless plugins to load plugin-browser-session before any initialization happens.

Testing

Covered by existing tests

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Dec 15, 2025

@bugsnag/browser bundle size diff

Minified Minfied + Gzipped
Before 47.74 kB 14.17 kB
After 47.74 kB 14.17 kB
± No change No change

code coverage diff

<temporarily disabled>

Generated by 🚫 dangerJS against db486cd

gingerbenw
gingerbenw previously approved these changes Dec 15, 2025
@gingerbenw
Copy link
Copy Markdown
Contributor

changelog!

@hamudi-ahmed hamudi-ahmed force-pushed the PLAT-15388/plugin-server-session-lazy-init branch from 0eff8fb to db486cd Compare December 15, 2025 17:46
@hamudi-ahmed hamudi-ahmed merged commit 731ccb7 into next Dec 16, 2025
22 checks passed
@hamudi-ahmed hamudi-ahmed deleted the PLAT-15388/plugin-server-session-lazy-init branch December 16, 2025 15:41
@gingerbenw gingerbenw mentioned this pull request Jan 20, 2026
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.

2 participants