Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions docs/config/extensions/playwright.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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: "<project ref>",
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.
Expand Down
8 changes: 8 additions & 0 deletions docs/docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,14 @@
"management/envvars/update",
"management/envvars/delete"
]
},
{
"group": "Deployments API",
"pages": [
"management/deployments/retrieve",
"management/deployments/get-latest",
"management/deployments/promote"
]
}
]
},
Expand Down
4 changes: 4 additions & 0 deletions docs/management/deployments/get-latest.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
title: "Get latest deployment"
openapi: "v3-openapi GET /api/v1/deployments/latest"
---
4 changes: 4 additions & 0 deletions docs/management/deployments/promote.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
title: "Promote deployment"
openapi: "v3-openapi POST /api/v1/deployments/{version}/promote"
---
4 changes: 4 additions & 0 deletions docs/management/deployments/retrieve.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
title: "Get deployment"
openapi: "v3-openapi GET /api/v1/deployments/{deploymentId}"
---
228 changes: 228 additions & 0 deletions docs/v3-openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Comment on lines +607 to +669
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# First, find and check the OpenAPI YAML file
find . -name "*openapi*" -o -name "v3-openapi.yaml" 2>/dev/null

# Check file size and basic structure
if [ -f "docs/v3-openapi.yaml" ]; then
  wc -l docs/v3-openapi.yaml
  echo "---"
  # Look for both endpoint definitions
  rg -n "/api/v1/deployments" docs/v3-openapi.yaml | head -20
fi

Repository: triggerdotdev/trigger.dev

Length of output: 769


🏁 Script executed:

#!/bin/bash
# Read the deployment endpoint schema
sed -n '508,606p' docs/v3-openapi.yaml

Repository: triggerdotdev/trigger.dev

Length of output: 3657


🏁 Script executed:

#!/bin/bash
# Check for components/schemas section that might define a shared Deployment schema
rg -n "components:" docs/v3-openapi.yaml
echo "---"
# Look for Deployment schema definitions
rg -n "Deployment:" docs/v3-openapi.yaml | head -20
echo "---"
# Check if the file follows Prettier formatting (check for YAML formatting issues)
# Look at specific sections with potential formatting issues
sed -n '607,650p' docs/v3-openapi.yaml | cat -A

Repository: triggerdotdev/trigger.dev

Length of output: 1849


🏁 Script executed:

#!/bin/bash
# Read the components section
sed -n '1621,1700p' docs/v3-openapi.yaml

Repository: triggerdotdev/trigger.dev

Length of output: 3194


🏁 Script executed:

#!/bin/bash
# Search for Deployment schema in the schemas section
rg -n "schemas:" docs/v3-openapi.yaml
echo "---"
# Look for deployment-related schema definitions
rg -n "^\s+Deployment|^\s+Deployment:" docs/v3-openapi.yaml

Repository: triggerdotdev/trigger.dev

Length of output: 88


🏁 Script executed:

#!/bin/bash
# Read the schemas section to check what's defined
sed -n '1747,1850p' docs/v3-openapi.yaml

Repository: triggerdotdev/trigger.dev

Length of output: 3737


🏁 Script executed:

#!/bin/bash
# Check if there's a backend implementation to understand if this is intentional
# Search for deployment route handlers
find . -type f \( -name "*.ts" -o -name "*.js" \) -path "*/routes/*" -o -path "*/api/*" 2>/dev/null | grep -i deploy | head -10
echo "---"
# Search for getLatestDeployment handler
rg -l "getLatestDeployment|get_latest_deployment" --type ts | head -10

Repository: triggerdotdev/trigger.dev

Length of output: 753


🏁 Script executed:

#!/bin/bash
# Check the implementation of the latest deployment endpoint
cat ./apps/webapp/app/routes/api.v1.deployments.latest.ts
echo "=== END LATEST ==="
echo ""
# Check the implementation of the specific deployment endpoint
cat ./apps/webapp/app/routes/api.v1.deployments.\$deploymentId.ts | head -100

Repository: triggerdotdev/trigger.dev

Length of output: 3672


🏁 Script executed:

#!/bin/bash
# Check the coding guidelines - verify if Prettier is meant to apply to YAML
# Look for prettier config
find . -name ".prettierrc*" -o -name "prettier.config.*" 2>/dev/null | head -5
echo "---"
# Check if YAML formatting is properly applied (check indentation/structure)
sed -n '607,620p' docs/v3-openapi.yaml | od -c | head -30

Repository: triggerdotdev/trigger.dev

Length of output: 184


🏁 Script executed:

#!/bin/bash
# Check if prettier config includes yaml
cat ./prettier.config.js | head -40

Repository: triggerdotdev/trigger.dev

Length of output: 277


🏁 Script executed:

#!/bin/bash
# Check if there's a .prettierignore file
if [ -f ".prettierignore" ]; then
  cat .prettierignore | grep -i yaml
  echo "---"
  cat .prettierignore | grep -i docs
fi
echo "---"
# Check if prettier should be applied to YAML - try to run prettier check (may not be available)
# but first verify the file's YAML indentation consistency
head -100 docs/v3-openapi.yaml | grep -E "^  " | head -20

Repository: triggerdotdev/trigger.dev

Length of output: 825


Response schema difference is intentional—document the design decision or refactor.

The get_latest_deployment_v1 endpoint intentionally returns fewer fields than get_deployment_v1. The backend implementation confirms it omits imagePlatform, externalBuildData, and the worker object.

To improve maintainability, consider:

  1. Extracting a reusable Deployment schema in components/schemas to reduce duplication
  2. Or add a comment in the OpenAPI spec explaining why the latest endpoint returns a subset of fields
🧰 Tools
🪛 Gitleaks (8.30.0)

[high] 665-668: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)

🤖 Prompt for AI Agents
In `@docs/v3-openapi.yaml` around lines 607 - 669, The get_latest_deployment_v1
response intentionally omits imagePlatform, externalBuildData, and worker
compared to get_deployment_v1; either refactor by extracting a reusable
Deployment schema under components/schemas (create a Deployment model with all
common fields and then use an inline subset or a DeploymentSummary schema for
the latest endpoint) or add a clear comment/description in the OpenAPI file near
the /api/v1/deployments/latest operation (or in components/schemas) stating that
get_latest_deployment_v1 returns a reduced DeploymentSummary and intentionally
omits imagePlatform, externalBuildData, and worker to match backend behavior;
update references to get_deployment_v1, Deployment, imagePlatform,
externalBuildData, and worker so readers can see the relationship.

"/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"
Expand Down