Repository navigation
fix(cli): apply extraCACerts on deploy #5053
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "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. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,7 +50,7 @@ import { | |
| } from "../cli/common.js"; | ||
| import { loadConfig } from "../config.js"; | ||
| import { authenticateForDeploy, userIdForDeploy } from "../deploy/auth.js"; | ||
| import { buildImage } from "../deploy/buildImage.js"; | ||
| import { buildImage, resolveExtraCACertsImagePath } from "../deploy/buildImage.js"; | ||
| import { type DeployEnvironment, resolveDeployEnvironment } from "../deploy/environment.js"; | ||
| import { | ||
| checkLogsForErrors, | ||
|
|
@@ -776,6 +776,10 @@ async function _deployCommand(dir: string, options: DeployCommandOptions) { | |
| externalBuildProjectId: deployment.externalBuildData?.projectId, | ||
| projectId: projectClient.id, | ||
| projectRef: resolvedConfig.project, | ||
| extraCACerts: resolveExtraCACertsImagePath( | ||
| resolvedConfig.extraCACerts, | ||
| resolvedConfig.workingDir | ||
| ), | ||
|
Comment on lines
+779
to
+782
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 Native deployments ignore configured CA certificates For native or local-bundle deployments, Learn moreThe 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 Example: A project with Recommended fix: Carry the resolved CA image path through both native deployment requests and set Was this helpful? React with 👍 or 👎 to provide feedback. |
||
| apiUrl: projectClient.client.apiURL, | ||
| apiKey: projectClient.client.accessToken!, | ||
| apiClient: projectClient.client, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,7 @@ import { depot } from "@depot/cli"; | |
| import { x } from "tinyexec"; | ||
| import type { BuildManifest, BuildRuntime } from "@trigger.dev/core/v3/schemas"; | ||
| import { networkInterfaces } from "os"; | ||
| import { join } from "path"; | ||
| import { isAbsolute, join, relative } from "path"; | ||
| import { safeReadJSONFile } from "../utilities/fileSystem.js"; | ||
| import { readFileSync } from "fs"; | ||
|
|
||
|
|
@@ -1305,3 +1305,25 @@ function getOutputOptions({ | |
|
|
||
| return outputOptions; | ||
| } | ||
|
|
||
| // The extraCACerts config option is project-relative, but NODE_EXTRA_CA_CERTS | ||
| // must point at the file inside the deployed image. additionalFiles copies it | ||
| // into the build output root, which becomes /app in the image. | ||
| export function resolveExtraCACertsImagePath( | ||
| extraCACerts: string | undefined, | ||
| workingDir: string | ||
| ): string | undefined { | ||
| if (!extraCACerts) { | ||
| return undefined; | ||
| } | ||
|
|
||
| const projectRelativePath = isAbsolute(extraCACerts) | ||
| ? relative(workingDir, extraCACerts) | ||
| : extraCACerts; | ||
|
|
||
| const segments = projectRelativePath | ||
| .split(/[\\/]+/) | ||
| .filter((segment) => segment && segment !== "." && segment !== ".."); | ||
|
|
||
| return `/app/${segments.join("/")}`; | ||
|
Comment on lines
+1324
to
+1328
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Parent segments misroute deployed CA files With Learn moreThe certificate copier findFilesByMatchers resolves the matched file and then calculates its destination relative to the project root. This resolves an internal Example: With a project root of Recommended fix: Normalize the relative input against Was this helpful? React with 👍 or 👎 to provide feedback. |
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Release note exposes build internals
The
extraCACertschangeset describes build extensions and arguments instead of leading with the user-visible trust fix. Customers receive this implementation detail verbatim in the changelog.Was this helpful? React with 👍 or 👎 to provide feedback.