Repository navigation
fix(cli): apply extraCACerts on deploy - #5053
princejain756 wants to merge 1 commit into
Conversation
resolvedConfig.extraCACerts was never passed to buildImage(), so the generated Containerfile set NODE_EXTRA_CA_CERTS to an empty value and Node ignored the configured CA bundle at runtime. The CA file is now copied into the build output via the additionalFiles extension, and the deploy command passes its image path (resolved the same way additionalFiles maps files under /app) as the NODE_EXTRA_CA_CERTS build arg. Fixes triggerdotdev#5028
🦋 Changeset detectedLatest commit: 4f03f71 The changes in this PR will be included in the next version bump. This PR includes changesets to release 30 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Hi @princejain756, 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. |
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
📒 Files selected for processing: 5
✨ Finishing Touches
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. Comment |
| extraCACerts: resolveExtraCACertsImagePath( | ||
| resolvedConfig.extraCACerts, | ||
| resolvedConfig.workingDir | ||
| ), |
There was a problem hiding this comment.
🔴 Native deployments ignore configured CA certificates
For native or local-bundle deployments, extraCACerts copies the certificate but never sets its image path. Both paths return before buildImage, leaving NODE_EXTRA_CA_CERTS empty in deployed tasks.
Learn more
The CLI selects its build path before this call. handleNativeBuildServerDeploy uploads source for a server-side build, while handleLocalBundleDeploy uploads the already bundled output. Both return without calling buildImage, so the new build argument only reaches the Depot and local Docker paths. The certificate is included by the new extension, but the generated Containerfile still sets NODE_EXTRA_CA_CERTS from an unset build argument.
Example: A project with extraCACerts: "./certs/corp.pem" and the native build path uploads corp.pem. Its deployed tasks start with NODE_EXTRA_CA_CERTS= rather than /app/certs/corp.pem.
Recommended fix: Carry the resolved CA image path through both native deployment requests and set NODE_EXTRA_CA_CERTS in their image-build arguments. Preserve the path through the local-bundle request and verify both build paths with an actual certificate.
Was this helpful? React with 👍 or 👎 to provide feedback.
| const segments = projectRelativePath | ||
| .split(/[\\/]+/) | ||
| .filter((segment) => segment && segment !== "." && segment !== ".."); | ||
|
|
||
| return `/app/${segments.join("/")}`; |
There was a problem hiding this comment.
🟡 Parent segments misroute deployed CA files
With extraCACerts: "./certs/../root.pem", resolveExtraCACertsImagePath returns /app/certs/root.pem. The file copier normalizes that path and places the certificate at /app/root.pem, so tasks cannot load it.
Learn more
The certificate copier findFilesByMatchers resolves the matched file and then calculates its destination relative to the project root. This resolves an internal .. segment before copying. The new resolver simply removes .., leaving the preceding folder in the image path.
Example: With a project root of /project and extraCACerts: "./certs/../root.pem", the copier writes /app/root.pem, while NODE_EXTRA_CA_CERTS points at /app/certs/root.pem.
Recommended fix: Normalize the relative input against workingDir with resolve, derive its project-relative destination as the copier does, then strip only leading parent segments.
Was this helpful? React with 👍 or 👎 to provide feedback.
| "trigger.dev": patch | ||
| --- | ||
|
|
||
| Fix `extraCACerts` in `trigger.config.ts` having no effect on deployed tasks. The configured CA file is now copied into the deployment image via the `additionalFiles` build extension, and the deploy command passes its image path to the `NODE_EXTRA_CA_CERTS` build argument, so self-signed or corporate certificates are trusted at runtime. |
There was a problem hiding this comment.
🟡 Release note exposes build internals
The extraCACerts changeset describes build extensions and arguments instead of leading with the user-visible trust fix. Customers receive this implementation detail verbatim in the changelog.
| Fix `extraCACerts` in `trigger.config.ts` having no effect on deployed tasks. The configured CA file is now copied into the deployment image via the `additionalFiles` build extension, and the deploy command passes its image path to the `NODE_EXTRA_CA_CERTS` build argument, so self-signed or corporate certificates are trusted at runtime. | |
| Deployed tasks now trust custom CA certificates configured with `extraCACerts`. |
Was this helpful? React with 👍 or 👎 to provide feedback.
Summary
Fixes #5028
resolvedConfig.extraCACertswas never passed tobuildImage(), so the generated Containerfile setNODE_EXTRA_CA_CERTS=(empty) and Node ignored the configured CA bundle at runtime.Two pieces were missing:
validateConfignow appends theadditionalFilesbuild extension forconfig.extraCACerts, the same mechanism the deprecatedadditionalFilesconfig option already uses, so the file is copied into the build output.deploydid not pass the option tobuildImage. It now passesresolveExtraCACertsImagePath(resolvedConfig.extraCACerts, resolvedConfig.workingDir), which maps the project-relative path to its location under/appin the image using the same rules ascopyFiles.ts(leading./and../segments stripped, absolute paths relativized to the working dir).Test plan
resolveExtraCACertsImagePathinbuildImage.test.ts(undefined, project-relative, leading../, absolute)@trigger.dev/databaseis pruned, sopackages/corecannot build for vitest); oxlint and oxfmt pass on all touched files