Skip to content

withSentryConfig opens a terminal window on Windows when next dev stops (git rev-parse without windowsHide) #26220

Closed

Description

@SamWylde

Is there an existing issue for this?

  • I have checked for existing issues
  • I have reviewed the documentation
  • I am using the latest SDK release

How do you use Sentry?

Sentry SaaS (sentry.io)

Which SDK are you using?

@sentry/nextjs

SDK Version

11.11.0

Framework Version

Next.js 16.4.6, Node.js 26.13.0, Windows 11 with Windows Terminal as the default terminal

Link to Sentry event

No response

Reproduction Example/SDK Setup

// next.config.mjs, in a git repo
import { withSentryConfig } from '@sentry/nextjs/config';

export default withSentryConfig({}, { silent: true, telemetry: false });

There's no release.name, no SENTRY_RELEASE and no CI commit variable, so the release name falls back to getGitRevision().

Steps to Reproduce

  1. On Windows, run next dev in that app.
  2. Stop it. I ended the dev server's child process. Ctrl+C goes through the same handleSessionStop() and flushDetached() in next/dist/cli/next-dev.js.
  3. Watch the screen right after it stops.

Expected Result

No window. The git lookup should run hidden, the way gitRevision() in the bundler plugins has since getsentry/sentry-javascript-bundler-plugins#941.

Actual Result

A Windows Terminal window flashes up each time next dev stops.

When it stops, Next spawns next/dist/telemetry/detached-flush.js with detached: true to send its session-stopped event, so that process has no console. It loads next.config.mjs, withSentryConfig calls getGitRevision(), and execSync('git rev-parse HEAD') starts cmd.exe without windowsHide. Windows gives cmd.exe a new console, and that's the window. Turning off Next's telemetry doesn't help: next telemetry status says Disabled on my machine and the flush process still runs.

I first caught it with a window watcher on a real app. The window belonged to cmd.exe /d /s /c "git rev-parse HEAD", whose parent was node next\dist\telemetry\detached-flush.js dev ... under next dev -p 3077.

To check the current versions, I ran the repro above with a small preload script (NODE_OPTIONS=--require) that logs child_process calls and forces windowsHide on, so nothing opened while I tested:

pid 28680  next/dist/bin/next           spawn     node next/dist/telemetry/detached-flush.js dev <app> _events_28680_4c480dba
           options: {"windowsHide":true,"detached":true,"shell":false}
pid 69848  telemetry/detached-flush.js  execSync  git rev-parse HEAD
           options: {"stdio":["ignore","pipe","ignore"]}
           at @sentry/nextjs/build/cjs/config/withSentryConfig/buildTime.js:54
           at @sentry/nextjs/build/cjs/config/withSentryConfig/getFinalConfigObjectUtils.js:21
           at @sentry/nextjs/build/cjs/config/withSentryConfig/getFinalConfigObject.js:10
           at @sentry/nextjs/build/cjs/config/withSentryConfig/index.js:26

The dev server process makes the same call when it starts, but it shares the console it was started from, so no window opens there.

Additional Context

The call is here:

gitRevision = childProcess
.execSync('git rev-parse HEAD', { stdio: ['ignore', 'pipe', 'ignore'] })
.toString()
.trim();

The SvelteKit package has the same one:

releaseFallback = child_process
.execSync('git rev-parse HEAD', { stdio: ['ignore', 'pipe', 'ignore'] })
.toString()
.trim();

The fix would be the same as getsentry/sentry-javascript-bundler-plugins#941: add windowsHide: true to both execSync calls. It has no effect on macOS or Linux.

Until then, setting release.name or SENTRY_RELEASE, or release: { create: false }, skips the lookup.

I can send a PR for both, with a test like the one in that PR, if you'd like.

Priority

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it.

Activity

  1. linear-code commented on Nov 10, 2026

    @linear-code
  2. self-assigned this
    on Nov 10, 2026
  3. nicohrubec commented on Nov 10, 2026

    @nicohrubec
    Member

    Hey, thanks for the report. It's fixed with the next release.

  4. added a commit that references this issue on Nov 10, 2026
    decf917
  5. github-actions commented on Nov 10, 2026

    @github-actions
    Contributor

    A PR closing this issue has just been released 🚀

    This issue was referenced by PR #26223, which was included in the 11.12.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions