Skip to content

fix(cli): disable OTel in depot child to prevent OTEL_EXPORTER_OTLP_ENDPOINT build failures - #4370

Closed
eeshsaxena wants to merge 1 commit into
triggerdotdev:mainfrom
eeshsaxena:fix/depot-otel-env-leak
Closed

fix(cli): disable OTel in depot child to prevent OTEL_EXPORTER_OTLP_ENDPOINT build failures#4370
eeshsaxena wants to merge 1 commit into
triggerdotdev:mainfrom
eeshsaxena:fix/depot-otel-env-leak

Conversation

@eeshsaxena

@eeshsaxena eeshsaxena commented Jul 24, 2026

Copy link
Copy Markdown

Fixes #4321.

OTEL_EXPORTER_OTLP_ENDPOINT is a standard env var that lots of projects set. If it's in the shell when you run trigger deploy, the build fails before it starts - either with cannot merge resource due to conflicting Schema URL (valid URL) or failed to build resolver: passthrough: received empty target in Build() (invalid value like an encrypted dotenvx blob). Both look like depot outages, not a local env problem.

Why it happens

remoteBuildImage in buildImage.ts spawns the depot CLI via execa. Execa's default is extendEnv: true, so the env object passed to depot() is merged onto process.env rather than replacing it. Anything in the parent environment - including OTEL_EXPORTER_OTLP_ENDPOINT - is inherited by the depot child. The depot CLI reads that variable to initialise its own OTel exporter and dies during telemetry init before the build starts.

Fix

Add OTEL_SDK_DISABLED: "1" and OTEL_EXPORTER_OTLP_ENDPOINT: "" to the env block passed to depot(). Since execa merges envs, these explicit values override whatever the parent shell has, keeping ambient OTEL config out of the depot child entirely.

--local-build is unaffected (it runs docker buildx which tolerates the variable).

If OTEL_EXPORTER_OTLP_ENDPOINT is set in the shell (e.g. via a .env file
loaded by dotenv), the depot CLI inherits it because execa merges the env
object onto process.env rather than replacing it. The depot CLI then tries
to initialise its own OTel exporter using that endpoint:

- a valid URL causes a Schema URL conflict and the build exits with
  'cannot merge resource due to conflicting Schema URL'
- an invalid value (e.g. an encrypted dotenvx blob) causes
  'failed to build resolver: passthrough: received empty target in Build()'

Both surface as 'Error building image', which looks like a depot outage
rather than a local env variable problem, and --local-build is unaffected.

Set OTEL_SDK_DISABLED=1 and clear OTEL_EXPORTER_OTLP_ENDPOINT in the env
block passed to the depot child so ambient OTEL config can't reach it.

Fixes #4321
@changeset-bot

changeset-bot Bot commented Jul 24, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 84a7cf2

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ddb0894d-bdef-4e15-a87d-7f67ea87eb6d

📥 Commits

Reviewing files that changed from the base of the PR and between be45cf9 and 84a7cf2.

📒 Files selected for processing (1)
  • packages/cli-v3/src/deploy/buildImage.ts

Walkthrough

The image build flow now passes OTEL_SDK_DISABLED and an empty OTEL_EXPORTER_OTLP_ENDPOINT to the depot child process, preventing inherited OpenTelemetry configuration from affecting depot telemetry initialization.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

Hi @eeshsaxena, thanks for your interest in contributing!

This project requires that pull request authors are vouched, and you are not in the list of vouched users.

This PR will be closed automatically. See https://github.com/triggerdotdev/trigger.dev/blob/main/CONTRIBUTING.md for more details.

@github-actions github-actions Bot closed this Jul 24, 2026

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

Open in Devin Review

Comment on lines +264 to +265
OTEL_SDK_DISABLED: "1",
OTEL_EXPORTER_OTLP_ENDPOINT: "",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Change to a published package is missing its release-notes entry

This change updates the published CLI package (packages/cli-v3/src/deploy/buildImage.ts:259-265) but no changeset was added to the pull request, so the fix will not be versioned or appear in user-visible release notes.
Impact: The bug fix ships without a version bump or changelog entry, so users won't see it in release notes and the package version won't be updated.

Missing changeset for a public package change

AGENTS.md states: "When modifying any public package (packages/* or integrations/*), add a changeset" via pnpm run changeset:add, and CONTRIBUTING.md states that PRs touching /packages "will need to add a changeset to your Pull Requests before they can be merged." packages/cli-v3 is the published trigger.dev package. The PR's only diff is in packages/cli-v3/src/deploy/buildImage.ts and no file was added under .changeset/.

Prompt for agents
This PR modifies the published package packages/cli-v3 (trigger.dev on npm) but does not include a changeset. Per AGENTS.md and CONTRIBUTING.md, any change to a public package under packages/* requires a changeset. Run pnpm run changeset:add and create a patch changeset describing the fix for users (e.g. that deploying no longer fails when OTEL_EXPORTER_OTLP_ENDPOINT is present in the shell environment). Write the description for users, not maintainers, and avoid naming internal tools/infra.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: OTEL_EXPORTER_OTLP_ENDPOINT in the environment breaks trigger deploy (depot build)

1 participant