This repository was archived by the owner on Oct 23, 2026. It is now read-only.
Repository navigation
feat(local): inject Spotlight as a Wrangler Worker binding - #1351
Merged
MathurAditya724 merged 5 commits intoAug 3, 2026
Merged
Conversation
Wrangler does not expose inherited process environment variables to Worker code, so the SENTRY_SPOTLIGHT value set by local run never reached @sentry/cloudflare. Users had to hard-code spotlight: true in their SDK config. Detect Wrangler dev commands in Workers projects and add the ephemeral --var SENTRY_SPOTLIGHT:<url> binding. This works for direct/npx commands, package-manager scripts, auto-detected shell scripts, custom config paths and verify mode; explicit user bindings remain untouched. No wrangler config or .dev.vars files are modified. Co-authored-by: Aditya Mathur <MathurAditya724@users.noreply.github.com>
Contributor
|
BYK
reviewed
Aug 3, 2026
BYK
left a comment
Member
There was a problem hiding this comment.
Does this not work: https://developers.cloudflare.com/workers/configuration/environment-variables/#import-env-for-global-access
(we should do this on SDK side)
Shell-wrapped dev scripts were augmented by appending --var to the end of the entire script. For commands such as 'wrangler dev && echo done', that passed the binding to echo instead of Wrangler while still claiming injection succeeded. Scan from the wrangler dev invocation to the next unquoted shell control operator or redirection and insert the binding there. Operators inside quotes and command substitutions are ignored, and explicit Spotlight bindings inside shell scripts remain untouched. Addresses the Sentry bot review on #1351. Co-authored-by: Aditya Mathur <MathurAditya724@users.noreply.github.com>
The skill generator collects every bash block from command docs as a runnable CLI example. The explanatory block containing only '--var SENTRY_SPOTLIGHT:...' therefore appeared as a bare command under sentry local, detached from its Cloudflare context. Render the flag inline in the source fragment and regenerate the skill reference, preserving the explanation in docs while keeping the agent skill's examples executable. Co-authored-by: Aditya Mathur <MathurAditya724@users.noreply.github.com>
Inspect selected package.json script content before injecting so an explicit SENTRY_SPOTLIGHT binding is never duplicated or overridden. The wider review also tightens command detection and argument forwarding: only supported Wrangler executable positions match, quoted shell text is ignored, shell values are escaped, pnpm/yarn/bun avoid npm's separator, shorthand scripts and Windows paths work, custom configs inside scripts are detected, and compound package scripts warn instead of claiming a binding was injected into the wrong command. Addresses the second Sentry bot review on #1351. Co-authored-by: Aditya Mathur <MathurAditya724@users.noreply.github.com>
MathurAditya724
deleted the
cursor/inject-wrangler-spotlight-binding-27d6
branch
August 3, 2026 19:27
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Wrangler does not expose inherited process environment variables to Worker code, so the SENTRY_SPOTLIGHT value set by local run never reached @sentry/cloudflare. Users had to hard-code spotlight: true in their SDK config.
Detect Wrangler dev commands in Workers projects and add the ephemeral --var SENTRY_SPOTLIGHT: binding. This works for direct/npx commands, package-manager scripts, auto-detected shell scripts, custom config paths and verify mode; explicit user bindings remain untouched. No wrangler config or .dev.vars files are modified.