diff --git a/docs/config/extensions/playwright.mdx b/docs/config/extensions/playwright.mdx index db9ad34257..ea8461301e 100644 --- a/docs/config/extensions/playwright.mdx +++ b/docs/config/extensions/playwright.mdx @@ -91,6 +91,32 @@ The extension sets the following environment variables during the build: - `PLAYWRIGHT_SKIP_BROWSER_VALIDATION`: Set to `1` to skip browser validation at runtime - `DISPLAY`: Set to `:99` if `headless: false` (for Xvfb) +## Troubleshooting + +### Browser download failures + +If you encounter errors during the build process related to browser downloads (e.g., "failed to solve: process did not complete successfully: exit code: 9"), this is a known issue with certain Playwright versions. + +**Workaround:** Revert Playwright to version `1.40.0` in your project dependencies. You can specify this version explicitly in your config: + +```ts +import { defineConfig } from "@trigger.dev/sdk"; +import { playwright } from "@trigger.dev/build/extensions/playwright"; + +export default defineConfig({ + project: "", + build: { + extensions: [ + playwright({ + version: "1.40.0", + }), + ], + }, +}); +``` + +For more details, see [GitHub issue #2440](https://github.com/triggerdotdev/trigger.dev/issues/2440#issuecomment-3815104376). + ## Managing browser instances To prevent issues with waits and resumes, you can use middleware and locals to manage the browser instance. This will ensure the browser is available for the whole run, and is properly cleaned up on waits, resumes, and after the run completes. diff --git a/docs/docs.json b/docs/docs.json index cff62e6d09..bfca1eefac 100644 --- a/docs/docs.json +++ b/docs/docs.json @@ -269,6 +269,14 @@ "management/envvars/update", "management/envvars/delete" ] + }, + { + "group": "Deployments API", + "pages": [ + "management/deployments/retrieve", + "management/deployments/get-latest", + "management/deployments/promote" + ] } ] }, diff --git a/docs/management/deployments/get-latest.mdx b/docs/management/deployments/get-latest.mdx new file mode 100644 index 0000000000..78be92be29 --- /dev/null +++ b/docs/management/deployments/get-latest.mdx @@ -0,0 +1,4 @@ +--- +title: "Get latest deployment" +openapi: "v3-openapi GET /api/v1/deployments/latest" +--- diff --git a/docs/management/deployments/promote.mdx b/docs/management/deployments/promote.mdx new file mode 100644 index 0000000000..e1e885c0d7 --- /dev/null +++ b/docs/management/deployments/promote.mdx @@ -0,0 +1,4 @@ +--- +title: "Promote deployment" +openapi: "v3-openapi POST /api/v1/deployments/{version}/promote" +--- diff --git a/docs/management/deployments/retrieve.mdx b/docs/management/deployments/retrieve.mdx new file mode 100644 index 0000000000..8a7eb21557 --- /dev/null +++ b/docs/management/deployments/retrieve.mdx @@ -0,0 +1,4 @@ +--- +title: "Get deployment" +openapi: "v3-openapi GET /api/v1/deployments/{deploymentId}" +--- diff --git a/docs/v3-openapi.yaml b/docs/v3-openapi.yaml index d406ce6c93..2fdcd0afd9 100644 --- a/docs/v3-openapi.yaml +++ b/docs/v3-openapi.yaml @@ -505,6 +505,234 @@ paths: await runs.cancel("run_1234"); + "/api/v1/deployments/{deploymentId}": + parameters: + - in: path + name: deploymentId + required: true + schema: + type: string + description: The deployment ID. + get: + operationId: get_deployment_v1 + summary: Get deployment + description: Retrieve information about a specific deployment by its ID. + responses: + "200": + description: Successful request + content: + application/json: + schema: + type: object + properties: + id: + type: string + description: The deployment ID + status: + type: string + enum: ["PENDING", "INSTALLING", "BUILDING", "DEPLOYING", "DEPLOYED", "FAILED", "CANCELED", "TIMED_OUT"] + description: The current status of the deployment + contentHash: + type: string + description: Hash of the deployment content + shortCode: + type: string + description: The short code for the deployment + version: + type: string + description: The deployment version (e.g., "20250228.1") + imageReference: + type: string + nullable: true + description: Reference to the deployment image + imagePlatform: + type: string + description: Platform of the deployment image + externalBuildData: + type: object + nullable: true + description: External build data if applicable + errorData: + type: object + nullable: true + description: Error data if the deployment failed + worker: + type: object + nullable: true + description: Worker information if available + properties: + id: + type: string + version: + type: string + tasks: + type: array + items: + type: object + properties: + id: + type: string + slug: + type: string + filePath: + type: string + exportName: + type: string + "401": + description: Unauthorized - Access token is missing or invalid + "404": + description: Deployment not found + tags: + - deployments + security: + - secretKey: [] + x-codeSamples: + - lang: typescript + source: |- + const response = await fetch( + `https://api.trigger.dev/api/v1/deployments/${deploymentId}`, + { + method: "GET", + headers: { + "Authorization": `Bearer ${secretKey}`, + }, + } + ); + const deployment = await response.json(); + - lang: curl + source: |- + curl -X GET "https://api.trigger.dev/api/v1/deployments/deployment_1234" \ + -H "Authorization: Bearer tr_dev_1234" + + "/api/v1/deployments/latest": + get: + operationId: get_latest_deployment_v1 + summary: Get latest deployment + description: Retrieve information about the latest unmanaged deployment for the authenticated project. + responses: + "200": + description: Successful request + content: + application/json: + schema: + type: object + properties: + id: + type: string + description: The deployment ID + status: + type: string + enum: ["PENDING", "INSTALLING", "BUILDING", "DEPLOYING", "DEPLOYED", "FAILED", "CANCELED", "TIMED_OUT"] + description: The current status of the deployment + contentHash: + type: string + description: Hash of the deployment content + shortCode: + type: string + description: The short code for the deployment + version: + type: string + description: The deployment version (e.g., "20250228.1") + imageReference: + type: string + nullable: true + description: Reference to the deployment image + errorData: + type: object + nullable: true + description: Error data if the deployment failed + "401": + description: Unauthorized - API key is missing or invalid + "404": + description: No deployment found + tags: + - deployments + security: + - secretKey: [] + x-codeSamples: + - lang: typescript + source: |- + const response = await fetch( + "https://api.trigger.dev/api/v1/deployments/latest", + { + method: "GET", + headers: { + "Authorization": `Bearer ${secretKey}`, + }, + } + ); + const deployment = await response.json(); + - lang: curl + source: |- + curl -X GET "https://api.trigger.dev/api/v1/deployments/latest" \ + -H "Authorization: Bearer tr_dev_1234" + + "/api/v1/deployments/{version}/promote": + parameters: + - in: path + name: version + required: true + schema: + type: string + description: The deployment version to promote (e.g., "20250228.1"). + post: + operationId: promote_deployment_v1 + summary: Promote deployment + description: Promote a previously deployed version to be the current version for the environment. This makes the specified version active for new task runs. + responses: + "200": + description: Deployment promoted successfully + content: + application/json: + schema: + type: object + properties: + id: + type: string + description: The deployment ID + version: + type: string + description: The deployment version (e.g., "20250228.1") + shortCode: + type: string + description: The short code for the deployment + "400": + description: Invalid request + content: + application/json: + schema: + type: object + properties: + error: + type: string + "401": + description: Unauthorized - API key is missing or invalid + "404": + description: Deployment not found + tags: + - deployments + security: + - secretKey: [] + x-codeSamples: + - lang: typescript + source: |- + const response = await fetch( + `https://api.trigger.dev/api/v1/deployments/${version}/promote`, + { + method: "POST", + headers: { + "Authorization": `Bearer ${secretKey}`, + "Content-Type": "application/json", + }, + } + ); + const result = await response.json(); + - lang: curl + source: |- + curl -X POST "https://api.trigger.dev/api/v1/deployments/20250228.1/promote" \ + -H "Authorization: Bearer tr_dev_1234" \ + -H "Content-Type: application/json" + "/api/v1/runs/{runId}/reschedule": parameters: - $ref: "#/components/parameters/runId"