Repository navigation
Conversation
|
bugbot run |
size-limit report 📦Compared: 5dab66a (PR test merge using develop at eb0e92e) Against: eb0e92e (develop) · base run #65112 ✅ Baseline matches: this diff contains only this PR's changes.
|
Optional E2E testsSome optional checks were not successful. They do not block the merge. 6 not successful, 50 successful. See the run.
Successful checks
|
|
bugbot run |
|
bugbot run |
|
bugbot run |
|
bugbot run |
Nitro loads TanStack Start's server entry on the first request, so an instrument import at the top of the server entry only initializes the SDK during that request. Without node --import, as on Vercel, the first request of every server instance has no http.server span. The Vite plugin now adds a Nitro plugin that imports the server entry at startup. It imports the same chunk Nitro loads lazily, so the SDK is not bundled a second time. Fixes #25970 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nit test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Read the service entries from Nitro's vite-services module instead of deriving them, so the preload uses the same specifiers and skips server environments that are not Nitro services. Add a preloadServerEntry option to opt out, and check in the e2e test that the preload did not time out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…o services Also formats the e2e Vite config. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
0aad0ec to
7c08218
Compare
…e Nitro build Older Nitro betas generate the module that imports the services as #nitro-vite-setup, so the preload did nothing there. The preload module now loads that module itself, under either name. The service build leaves some packages as plain imports, so it could not see when one of them imports the Nitro runtime. Whether a service entry imports the preload module is now decided from the module graph of the Nitro build. Also logs with debug enabled, shares the Nitro options type, and no longer starts an unused app server in the init-in-server-entry e2e variant. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
bugbot run |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 3e30f13. Configure here.
| 'if (awaited.length > 0) {', | ||
| ' let loaded = false;', | ||
| ' let timeout;', | ||
| ` await Promise.race([Promise.all(awaited).then(() => { loaded = true; }), new Promise(resolve => { timeout = setTimeout(resolve, ${PRELOAD_TIMEOUT_MS}); })]);`, |
There was a problem hiding this comment.
Startup timer is not unref'd
Low Severity
The generated preload uses setTimeout without unref() or safeUnref(). That timer is injected into the Nitro server bundle, so a pending 3s fallback can keep a Node process alive. This was flagged because the project review rules require unref on timers in server runtime paths.
Triggered by project rule: PR Review Guidelines for Cursor Bot
Reviewed by Cursor Bugbot for commit 3e30f13. Configure here.
There was a problem hiding this comment.
Keeping the timer referenced on purpose. It only matters when the preload never settles, which happens with an import cycle the build did not detect. Then nothing else keeps the event loop alive, so with unref() Node would exit with code 13 (unsettled top-level await) before the timeout fires, which is the case the timeout exists for. The timer is cleared as soon as the preload finishes, and it keeps the process alive for at most 3s while the server starts.


Why: Nitro imports the TanStack Start server entry lazily on the first request. When
Sentry.initruns from aninstrument.serverimport in the server entry, as on Vercel where--importisn't available, it initializes too late for the first request'shttp.serverspan. The Vite plugin now adds a Nitro plugin that imports the service entries at server startup. It uses the same specifiers as Nitro, so no second SDK copy is bundled. The plugin uses top-level await so serverless platforms don't send the first request before init. Services that import the Nitro runtime are not awaited, to avoid an import cycle deadlock, and a 3s timeout is a fallback. You can turn it off withpreloadServerEntry: false.Unsure about: The preload reads Nitro's internal
#nitro/virtual/vite-servicestemplate. If that template changes shape, nothing is preloaded and we're back to the current behavior.Closes #25970