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.
Option 1: Global Environment Variable
Section titled “Option 1: Global Environment Variable”The simplest approach is to declare SENTRY_SPOTLIGHT as a global environment variable. This makes it available to all tasks in every package:
{ "globalEnv": ["SENTRY_SPOTLIGHT"]}Option 2: Scope to Specific Tasks
Section titled “Option 2: Scope to Specific Tasks”If you prefer more granular control, you can scope the variable to specific tasks using the tasks configuration:
{ "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.
Verify It Works
Section titled “Verify It Works”-
Set the environment variable in your
.envfile or shell:Terminal window SENTRY_SPOTLIGHT=1 -
Run your Turborepo dev task:
Terminal window turbo dev -
Open the Spotlight UI and confirm that telemetry from all packages appears.
Next Steps
Section titled “Next Steps”- Getting Started - Initial Spotlight setup
- CLI - Run apps with automatic instrumentation and stream events
- Sidecar - Learn about the local proxy server that powers Spotlight