Skip to content

Turborepo

When using Spotlight in a Turborepo monorepo, the SENTRY_SPOTLIGHT environment variable must be declared in turbo.json for it to be available to all packages. Without this, Turborepo may not forward the variable to packages that consume the Sentry SDK, and Spotlight won’t receive telemetry from those packages.

The simplest approach is to declare SENTRY_SPOTLIGHT as a global environment variable. This makes it available to all tasks in every package:

turbo.json
{
"globalEnv": ["SENTRY_SPOTLIGHT"]
}

If you prefer more granular control, you can scope the variable to specific tasks using the tasks configuration:

turbo.json
{
"tasks": {
"dev": {
"env": ["SENTRY_SPOTLIGHT"]
},
"build": {
"env": ["SENTRY_SPOTLIGHT"]
}
}
}

This ensures SENTRY_SPOTLIGHT is only forwarded to the dev and build tasks, keeping other tasks unaffected.

  1. Set the environment variable in your .env file or shell:

    Terminal window
    SENTRY_SPOTLIGHT=1
  2. Run your Turborepo dev task:

    Terminal window
    turbo dev
  3. Open the Spotlight UI and confirm that telemetry from all packages appears.

  • Getting Started - Initial Spotlight setup
  • CLI - Run apps with automatic instrumentation and stream events
  • Sidecar - Learn about the local proxy server that powers Spotlight