Skip to content

[v10] @sentry/node-core init() adds a Vercel SIGTERM listener per call #25825

Closed

Description

@sentry-junior

Package + version

@sentry/node-core 10.x (checked on the v10 branch at 10.77.1 and in published 10.63.0 and 10.75.2). Affects both init() from @sentry/node-core and @sentry/node-core/light.

Description

When process.env.VERCEL is set, both _init() paths (packages/node-core/src/sdk/index.ts and packages/node-core/src/light/sdk.ts) call process.on('SIGTERM', async () => client.flush(200)) on every call. The listener closes over that call's client and nothing removes it, including client.close().

Processes that call init() repeatedly gain one listener per call. Once there are more than 10, Node emits MaxListenersExceededWarning, and on SIGTERM every stale client gets flushed. We hit this in the Sentry CLI (getsentry/toolkit#1692). In library mode it re-inits the light SDK for each command, so @sentry/bundler-plugins source-map uploads during Vercel builds produce the warning after about 11 commands.

Reproduction

process.env.VERCEL = '1';
const Sentry = require('@sentry/node-core/light');
for (let i = 0; i < 15; i++) Sentry.init({});
console.log(process.listenerCount('SIGTERM')); // 15, plus a MaxListenersExceededWarning

Expected

A single SIGTERM listener that flushes the latest client, as @sentry/node does on v11 since #25146.

Notes

v11 (develop) is not affected: node-core was merged into @sentry/node, and #25146 fixed setupVercelKeepAlive. This only needs a fix on v10.

via @BYK.

--

View Junior Session [Sentry]

Activity

  1. linear-code commented on Oct 28, 2026

    @linear-code
  2. added a commit that references this issue on Oct 29, 2026
    20ee70a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions