@trigger.dev/sdk 4.8.4 → 4.8.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commonjs/v3/ai.d.ts +29 -5
- package/dist/commonjs/v3/ai.js +160 -114
- package/dist/commonjs/v3/ai.js.map +1 -1
- package/dist/commonjs/v3/auth.d.ts +4 -4
- package/dist/commonjs/v3/auth.js +21 -75
- package/dist/commonjs/v3/auth.js.map +1 -1
- package/dist/commonjs/v3/chat-client.d.ts +1 -1
- package/dist/commonjs/v3/chat.d.ts +1 -1
- package/dist/commonjs/v3/prompt.js +6 -8
- package/dist/commonjs/v3/prompt.js.map +1 -1
- package/dist/commonjs/v3/runs.d.ts +5 -1
- package/dist/commonjs/v3/runs.js.map +1 -1
- package/dist/commonjs/v3/sessions.js +10 -7
- package/dist/commonjs/v3/sessions.js.map +1 -1
- package/dist/commonjs/v3/shared.d.ts +2 -2
- package/dist/commonjs/v3/shared.js +16 -15
- package/dist/commonjs/v3/shared.js.map +1 -1
- package/dist/commonjs/v3/steeringContext.d.ts +35 -10
- package/dist/commonjs/v3/steeringContext.js +35 -12
- package/dist/commonjs/v3/steeringContext.js.map +1 -1
- package/dist/commonjs/v3/streams.js +10 -8
- package/dist/commonjs/v3/streams.js.map +1 -1
- package/dist/commonjs/v3/tasks.d.ts +2 -2
- package/dist/commonjs/v3/tasks.js.map +1 -1
- package/dist/commonjs/v3/test/mock-chat-agent.js +24 -13
- package/dist/commonjs/v3/test/mock-chat-agent.js.map +1 -1
- package/dist/commonjs/v3/webhooks.d.ts +8 -2
- package/dist/commonjs/v3/webhooks.js +20 -11
- package/dist/commonjs/v3/webhooks.js.map +1 -1
- package/dist/commonjs/version.js +1 -1
- package/dist/esm/v3/ai.d.ts +29 -5
- package/dist/esm/v3/ai.js +162 -117
- package/dist/esm/v3/ai.js.map +1 -1
- package/dist/esm/v3/auth.d.ts +4 -4
- package/dist/esm/v3/auth.js +22 -76
- package/dist/esm/v3/auth.js.map +1 -1
- package/dist/esm/v3/chat-client.d.ts +1 -1
- package/dist/esm/v3/chat.d.ts +1 -1
- package/dist/esm/v3/prompt.js +6 -8
- package/dist/esm/v3/prompt.js.map +1 -1
- package/dist/esm/v3/runs.d.ts +5 -1
- package/dist/esm/v3/runs.js.map +1 -1
- package/dist/esm/v3/sessions.js +10 -7
- package/dist/esm/v3/sessions.js.map +1 -1
- package/dist/esm/v3/shared.d.ts +2 -2
- package/dist/esm/v3/shared.js +16 -15
- package/dist/esm/v3/shared.js.map +1 -1
- package/dist/esm/v3/steeringContext.d.ts +35 -10
- package/dist/esm/v3/steeringContext.js +34 -12
- package/dist/esm/v3/steeringContext.js.map +1 -1
- package/dist/esm/v3/streams.js +10 -8
- package/dist/esm/v3/streams.js.map +1 -1
- package/dist/esm/v3/tasks.d.ts +2 -2
- package/dist/esm/v3/tasks.js.map +1 -1
- package/dist/esm/v3/test/mock-chat-agent.js +25 -14
- package/dist/esm/v3/test/mock-chat-agent.js.map +1 -1
- package/dist/esm/v3/webhooks.d.ts +8 -2
- package/dist/esm/v3/webhooks.js +20 -11
- package/dist/esm/v3/webhooks.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/docs/ai/observability.mdx +25 -19
- package/docs/ai/prompts.mdx +25 -19
- package/docs/ai-chat/actions.mdx +1 -1
- package/docs/ai-chat/anatomy.mdx +1 -1
- package/docs/ai-chat/backend.mdx +24 -24
- package/docs/ai-chat/background-injection.mdx +5 -5
- package/docs/ai-chat/chat-local.mdx +2 -2
- package/docs/ai-chat/compaction.mdx +38 -15
- package/docs/ai-chat/custom-agents.mdx +4 -4
- package/docs/ai-chat/error-handling.mdx +4 -4
- package/docs/ai-chat/fast-starts.mdx +8 -7
- package/docs/ai-chat/frontend.mdx +6 -2
- package/docs/ai-chat/lifecycle-hooks.mdx +11 -11
- package/docs/ai-chat/migrating-from-a-route-handler.mdx +4 -4
- package/docs/ai-chat/migrating-from-hydrate-messages.mdx +1 -1
- package/docs/ai-chat/overview.mdx +1 -1
- package/docs/ai-chat/patterns/branching-conversations.mdx +1 -1
- package/docs/ai-chat/patterns/database-persistence.mdx +2 -2
- package/docs/ai-chat/patterns/human-in-the-loop.mdx +1 -1
- package/docs/ai-chat/patterns/native-compaction.mdx +29 -9
- package/docs/ai-chat/patterns/persistence-and-replay.mdx +1 -1
- package/docs/ai-chat/patterns/redacting-telemetry.mdx +2 -2
- package/docs/ai-chat/patterns/skills.mdx +2 -2
- package/docs/ai-chat/patterns/sub-agents.mdx +1 -1
- package/docs/ai-chat/patterns/tool-result-auditing.mdx +1 -1
- package/docs/ai-chat/patterns/trusted-edge-signals.mdx +2 -2
- package/docs/ai-chat/patterns/version-upgrades.mdx +2 -2
- package/docs/ai-chat/pending-messages.mdx +5 -5
- package/docs/ai-chat/prompt-caching.mdx +7 -7
- package/docs/ai-chat/quick-start.mdx +2 -2
- package/docs/ai-chat/testing.mdx +9 -9
- package/docs/ai-chat/tools.mdx +9 -5
- package/docs/ai-chat/transcript-storage.mdx +2 -2
- package/docs/ai-chat/types.mdx +10 -3
- package/docs/apikeys.mdx +2 -1
- package/docs/cli-login-commands.mdx +12 -0
- package/docs/concurrency.mdx +40 -0
- package/docs/database-connections.mdx +1 -1
- package/docs/deploy-environment-variables.mdx +84 -2
- package/docs/deployment/trusted-publishing.mdx +4 -0
- package/docs/errors-retrying.mdx +25 -18
- package/docs/github-actions.mdx +1 -1
- package/docs/github-integration.mdx +21 -0
- package/docs/how-it-works.mdx +4 -2
- package/docs/introduction.mdx +1 -1
- package/docs/mcp-introduction.mdx +7 -1
- package/docs/mcp-remote.mdx +90 -0
- package/docs/oidc/azure.mdx +81 -0
- package/docs/oidc/databricks.mdx +99 -0
- package/docs/oidc/doppler.mdx +60 -0
- package/docs/oidc/gcp.mdx +109 -0
- package/docs/oidc/hugging-face.mdx +90 -0
- package/docs/oidc/openrouter.mdx +91 -0
- package/docs/oidc/snowflake.mdx +91 -0
- package/docs/oidc/vault.mdx +71 -0
- package/docs/oidc.mdx +2 -0
- package/docs/runs/metadata.mdx +1 -1
- package/docs/self-hosting/docker.mdx +2 -0
- package/docs/self-hosting/env/webapp.mdx +4 -1
- package/docs/self-hosting/kubernetes.mdx +2 -0
- package/docs/tasks/schemaTask.mdx +26 -13
- package/docs/tasks/streams.mdx +2 -2
- package/docs/troubleshooting.mdx +7 -0
- package/docs/webhooks/channels.mdx +6 -6
- package/docs/webhooks/connect.mdx +9 -75
- package/docs/webhooks/custom-providers.mdx +87 -0
- package/docs/webhooks/deliveries.mdx +7 -7
- package/docs/webhooks/filters.mdx +2 -2
- package/docs/webhooks/how-it-works.mdx +58 -0
- package/docs/webhooks/human-in-the-loop.mdx +3 -3
- package/docs/webhooks/linear.mdx +5 -3
- package/docs/webhooks/overview.mdx +20 -71
- package/docs/webhooks/own-handler.mdx +62 -0
- package/docs/webhooks/pricing-and-limits.mdx +13 -0
- package/docs/webhooks/providers/attio.mdx +38 -0
- package/docs/webhooks/providers/autumn.mdx +40 -0
- package/docs/webhooks/providers/cal-com.mdx +41 -0
- package/docs/webhooks/providers/calendly.mdx +41 -0
- package/docs/webhooks/providers/clerk.mdx +40 -0
- package/docs/webhooks/providers/discord.mdx +45 -0
- package/docs/webhooks/providers/docusign.mdx +41 -0
- package/docs/webhooks/providers/elevenlabs.mdx +41 -0
- package/docs/webhooks/providers/firecrawl.mdx +54 -0
- package/docs/webhooks/providers/github.mdx +46 -0
- package/docs/webhooks/providers/gitlab.mdx +41 -0
- package/docs/webhooks/providers/granola.mdx +44 -0
- package/docs/webhooks/providers/hookdeck.mdx +98 -0
- package/docs/webhooks/providers/infisical.mdx +41 -0
- package/docs/webhooks/providers/jira.mdx +41 -0
- package/docs/webhooks/providers/langfuse.mdx +40 -0
- package/docs/webhooks/providers/linear.mdx +45 -0
- package/docs/webhooks/providers/loops.mdx +40 -0
- package/docs/webhooks/providers/metronome.mdx +42 -0
- package/docs/webhooks/providers/mux.mdx +40 -0
- package/docs/webhooks/providers/openai.mdx +40 -0
- package/docs/webhooks/providers/pagerduty.mdx +40 -0
- package/docs/webhooks/providers/plain.mdx +41 -0
- package/docs/webhooks/providers/planetscale.mdx +40 -0
- package/docs/webhooks/providers/recall-ai.mdx +54 -0
- package/docs/webhooks/providers/replicate.mdx +41 -0
- package/docs/webhooks/providers/resend.mdx +44 -0
- package/docs/webhooks/providers/retell.mdx +41 -0
- package/docs/webhooks/providers/sentry.mdx +41 -0
- package/docs/webhooks/providers/shopify.mdx +49 -0
- package/docs/webhooks/providers/slack.mdx +48 -0
- package/docs/webhooks/providers/square.mdx +40 -0
- package/docs/webhooks/providers/stripe.mdx +86 -0
- package/docs/webhooks/providers/supabase.mdx +41 -0
- package/docs/webhooks/providers/tailscale.mdx +43 -0
- package/docs/webhooks/providers/typeform.mdx +42 -0
- package/docs/webhooks/providers/vapi.mdx +47 -0
- package/docs/webhooks/providers/vercel.mdx +40 -0
- package/docs/webhooks/providers/whatsapp.mdx +45 -0
- package/docs/webhooks/providers/workos.mdx +41 -0
- package/docs/webhooks/providers/zendesk.mdx +41 -0
- package/docs/webhooks/providers.mdx +53 -0
- package/docs/webhooks/quick-start.mdx +131 -0
- package/docs/webhooks/session-routing.mdx +6 -6
- package/docs/webhooks/signing-secrets.mdx +80 -0
- package/docs/webhooks/slack.mdx +11 -2
- package/docs/webhooks/verification.mdx +139 -0
- package/docs/webhooks/waiters.mdx +2 -2
- package/docs/webhooks/webhook-tasks.mdx +46 -0
- package/package.json +4 -5
- package/docs/migrating-from-v3.mdx +0 -332
- package/docs/webhooks/public-beta.mdx +0 -70
- package/docs/webhooks/sources.mdx +0 -252
package/docs/webhooks/slack.mdx
CHANGED
|
@@ -6,11 +6,14 @@ sidebarTitle: "Slack agents"
|
|
|
6
6
|
|
|
7
7
|
**`slack()` from `@trigger.dev/slack` turns a `chat.agent` into a native Slack agent.** Each Slack agent session (a conversation with the agent, or a thread in a channel) becomes a durable Trigger.dev [session](/ai-chat/sessions). A message runs as a turn, the session shows the agent working, the reply streams into the thread as the model writes it, and Slack's stop button stops the turn.
|
|
8
8
|
|
|
9
|
+
Slack is one of our deep integrations: as well as delivering [webhook events](/webhooks/providers/slack), the connector handles Slack's agent features for you.
|
|
10
|
+
|
|
9
11
|
```ts /trigger/support.ts
|
|
10
12
|
import { webhooks } from "@trigger.dev/sdk";
|
|
11
13
|
import { chat } from "@trigger.dev/sdk/ai";
|
|
12
14
|
import { appMentions, slack, webhookSource } from "@trigger.dev/slack";
|
|
13
15
|
import { anthropic } from "@ai-sdk/anthropic";
|
|
16
|
+
import { stepCountIs } from "ai";
|
|
14
17
|
|
|
15
18
|
const slackEvents = webhooks.endpoint.define({ id: "slack", source: webhookSource() });
|
|
16
19
|
|
|
@@ -26,7 +29,13 @@ export const support = chat.agent({
|
|
|
26
29
|
],
|
|
27
30
|
tools: { searchDocs, refundOrder },
|
|
28
31
|
run: async ({ messages, tools, signal, streamText }) =>
|
|
29
|
-
streamText({
|
|
32
|
+
streamText({
|
|
33
|
+
model: anthropic("claude-sonnet-5-5"),
|
|
34
|
+
messages,
|
|
35
|
+
tools,
|
|
36
|
+
abortSignal: signal,
|
|
37
|
+
stopWhen: stepCountIs(10),
|
|
38
|
+
}),
|
|
30
39
|
});
|
|
31
40
|
```
|
|
32
41
|
|
|
@@ -245,7 +254,7 @@ Only buttons built with `button()` or `slackButton()` reach the agent. Buttons y
|
|
|
245
254
|
|
|
246
255
|
## Stopping
|
|
247
256
|
|
|
248
|
-
Slack shows a stop button while the agent is working. It aborts the running turn through the run's `signal`,
|
|
257
|
+
Slack shows a stop button while the agent is working. It aborts the running turn through the run's `signal`, as a browser chat's stop does: the model call and any tool that honors the signal stop, the partial reply stays in the thread, and the status goes back to active. The next message continues the conversation.
|
|
249
258
|
|
|
250
259
|
- A stop pressed while nothing is running does nothing, and a repeated or delayed stop never stops a later turn.
|
|
251
260
|
- A stop that reaches a session waiting on an approval cancels it: the buttons are replaced with "Stopped", the pending tool call is recorded as stopped so the model sees that on the next turn, and a later click resumes nothing.
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Webhook verification"
|
|
3
|
+
description: "How an endpoint verifies each provider's requests, answers provider handshakes, and types the event its subscribers receive."
|
|
4
|
+
sidebarTitle: "Verification"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**An endpoint's `source` tells Trigger.dev how to verify a provider's requests and what type the event has.** Use a [built-in provider](/webhooks/providers), such as `webhooks.stripe()` or `webhooks.firecrawl()`, or describe the provider's scheme with [`webhooks.custom()`](/webhooks/custom-providers).
|
|
8
|
+
|
|
9
|
+
## Presets
|
|
10
|
+
|
|
11
|
+
Presets supply the verification configuration, and most also carry the provider's part of the endpoint's [setup prompt](/webhooks/connect#set-it-up-with-an-ai-agent). Set the endpoint's signing secret or public key as described in [Connect a provider](/webhooks/connect).
|
|
12
|
+
|
|
13
|
+
<CodeGroup>
|
|
14
|
+
|
|
15
|
+
```ts /trigger/stripe.ts
|
|
16
|
+
import { webhook, webhooks } from "@trigger.dev/sdk";
|
|
17
|
+
|
|
18
|
+
export const stripe = webhooks.endpoint.define({ id: "stripe", source: webhooks.stripe() });
|
|
19
|
+
|
|
20
|
+
export const stripeEvents = webhook({
|
|
21
|
+
id: "stripe-events",
|
|
22
|
+
endpoint: stripe,
|
|
23
|
+
onEvent: async ({ event }) => {
|
|
24
|
+
if (event.type === "payment_intent.succeeded") {
|
|
25
|
+
console.log(event.id);
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```ts /trigger/github.ts
|
|
32
|
+
import { webhook, webhooks } from "@trigger.dev/sdk";
|
|
33
|
+
|
|
34
|
+
export const github = webhooks.endpoint.define({ id: "github", source: webhooks.github() });
|
|
35
|
+
|
|
36
|
+
export const githubEvents = webhook({
|
|
37
|
+
id: "github-events",
|
|
38
|
+
endpoint: github,
|
|
39
|
+
onEvent: async ({ headers }) => {
|
|
40
|
+
// GitHub puts the event type in a header
|
|
41
|
+
console.log(headers.get("x-github-event"));
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
```ts /trigger/svix.ts
|
|
47
|
+
import { webhook, webhooks } from "@trigger.dev/sdk";
|
|
48
|
+
|
|
49
|
+
export const svix = webhooks.endpoint.define({ id: "svix", source: webhooks.svix() });
|
|
50
|
+
|
|
51
|
+
export const svixEvents = webhook({
|
|
52
|
+
id: "svix-events",
|
|
53
|
+
endpoint: svix,
|
|
54
|
+
onEvent: async ({ event }) => {
|
|
55
|
+
console.log(event);
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
```ts /trigger/my-provider.ts
|
|
61
|
+
import { webhook, webhooks } from "@trigger.dev/sdk";
|
|
62
|
+
|
|
63
|
+
export const myProvider = webhooks.endpoint.define({ id: "my-provider", source: webhooks.standardWebhooks() });
|
|
64
|
+
|
|
65
|
+
export const myProviderEvents = webhook({
|
|
66
|
+
id: "my-provider-events",
|
|
67
|
+
endpoint: myProvider,
|
|
68
|
+
onEvent: async ({ event }) => {
|
|
69
|
+
console.log(event);
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
</CodeGroup>
|
|
75
|
+
|
|
76
|
+
The available presets are `stripe()`, `github()`, `svix()`, `standardWebhooks()`, `square()`, and `discord()`.
|
|
77
|
+
|
|
78
|
+
### Svix and Standard Webhooks
|
|
79
|
+
|
|
80
|
+
`svix()` and `standardWebhooks()` use HMAC-SHA256 over `id.timestamp.body` with a base64-encoded `whsec_` secret. Their header names differ:
|
|
81
|
+
|
|
82
|
+
| Source | Headers |
|
|
83
|
+
| --- | --- |
|
|
84
|
+
| `svix()` | `svix-id`, `svix-timestamp`, `svix-signature` |
|
|
85
|
+
| `standardWebhooks()` | `webhook-id`, `webhook-timestamp`, `webhook-signature` |
|
|
86
|
+
|
|
87
|
+
Named sources such as `webhooks.clerk()` and `webhooks.openai()` select the corresponding configuration.
|
|
88
|
+
|
|
89
|
+
## Named providers
|
|
90
|
+
|
|
91
|
+
More than 40 named providers, such as `webhooks.firecrawl()`, `webhooks.linear()` and `webhooks.hookdeck()`, build on the same verifiers. [Providers](/webhooks/providers) lists every one, with where to register the URL and set the signing secret.
|
|
92
|
+
|
|
93
|
+
## Custom providers
|
|
94
|
+
|
|
95
|
+
For a provider without a built-in source, describe its signature scheme with `webhooks.custom()`. See [Custom providers](/webhooks/custom-providers) for the verification schemes and options.
|
|
96
|
+
|
|
97
|
+
## Endpoint validation
|
|
98
|
+
|
|
99
|
+
Some sources also define a response for the provider's endpoint-validation request. These requests don't create deliveries or task runs.
|
|
100
|
+
|
|
101
|
+
`discord()` answers a verified `{ type: 0 }` PING with HTTP `204` and no body. It also returns `204` for accepted events and `401` for invalid signatures. Set the Discord application's public key as the endpoint's verification credential.
|
|
102
|
+
|
|
103
|
+
Slack's `url_verification` challenge is handled the same way by `@trigger.dev/slack`.
|
|
104
|
+
|
|
105
|
+
`notion()` handles Notion's verification request, which is not signed: when you create a subscription, Notion sends a `verification_token` that it then uses to sign every later delivery. While the endpoint has no signing secret, the endpoint answers that request with `200` and stores the token as its signing secret. The endpoint page shows the token so you can paste it into Notion's Verify dialog. If the token doesn't arrive, select **Resend token** in that dialog. Deploy the endpoint and leave its signing secret unset before you create the subscription. Once a secret is set, a later verification request is rejected like any unsigned delivery. Before you re-create the subscription or resend its token, select **Clear signing secret** on the endpoint page so the endpoint stores the new token.
|
|
106
|
+
|
|
107
|
+
`whatsapp()` answers Meta's GET verification request when `hub.mode` is `subscribe` and `hub.verify_token` matches the endpoint's verify token. It returns `hub.challenge` as text. The verify token is separate from the App Secret used to verify event signatures; see [Verify a WhatsApp endpoint URL](/webhooks/providers/whatsapp#verify-the-callback-url). Endpoints without GET verification return `405` to GET requests.
|
|
108
|
+
|
|
109
|
+
## Typing the event
|
|
110
|
+
|
|
111
|
+
Stripe and GitHub sources provide default event shapes; other sources default to `unknown`. Pass an event type to the source function for typed handler parameters and autocomplete. This example uses `Stripe.Event` from the `stripe` package, which must be installed in your project:
|
|
112
|
+
|
|
113
|
+
```ts /trigger/stripe.ts
|
|
114
|
+
import type Stripe from "stripe";
|
|
115
|
+
import { webhook, webhooks } from "@trigger.dev/sdk";
|
|
116
|
+
|
|
117
|
+
export const stripe = webhooks.endpoint.define({ id: "stripe", source: webhooks.stripe<Stripe.Event>() });
|
|
118
|
+
|
|
119
|
+
export const stripeEvents = webhook({
|
|
120
|
+
id: "stripe-events",
|
|
121
|
+
endpoint: stripe,
|
|
122
|
+
onEvent: async ({ event }) => {
|
|
123
|
+
console.log(event.type, event.id);
|
|
124
|
+
},
|
|
125
|
+
});
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
For `webhooks.custom<T>()`, pass your own event type as `T`. The endpoint's event type flows to every subscriber: `webhook()` handlers, `chat.event` keys and filters, and [waiter](/webhooks/waiters) `match` paths are all checked against it.
|
|
129
|
+
|
|
130
|
+
<Note>
|
|
131
|
+
Event types are compile-time annotations. Signature verification doesn't validate the body against
|
|
132
|
+
a TypeScript type. Validate `event` inside `onEvent` if your handler needs runtime schema checks.
|
|
133
|
+
</Note>
|
|
134
|
+
|
|
135
|
+
## How verification works
|
|
136
|
+
|
|
137
|
+
Requests must pass verification before they reach any subscriber. Sources can check a signature or credential, enforce a timestamp tolerance, and derive an idempotency key for [deduplication](/webhooks/deliveries#deduplication). Verification failures return the source's rejected HTTP status (`400` by default).
|
|
138
|
+
|
|
139
|
+
To verify a provider that isn't built in, choose a scheme for a [custom provider](/webhooks/custom-providers#verification-schemes).
|
|
@@ -67,7 +67,7 @@ Match on values you control, such as your own order id in the provider object's
|
|
|
67
67
|
| --- | --- |
|
|
68
68
|
| `event.*` | The verified event body, for example `event.data.object.id`. |
|
|
69
69
|
| `header.*` | A request header, matched case-insensitively, for example `header.x-shop-domain`. |
|
|
70
|
-
| `webhook.*` | The endpoint: `id`, `source`, `externalRef`, `tenantId`, or `deliveryId
|
|
70
|
+
| `webhook.*` | The endpoint: `id`, `source`, `externalRef`, `tenantId`, or `deliveryId` (the provider's event ID, or a hash of the request when the provider sends none; not the `whd_` id). |
|
|
71
71
|
|
|
72
72
|
A waiter can match up to five paths, and each value is a string, number or boolean. Paths are checked against the endpoint's event type at build time: an unknown field on a typed event, a path to an object, or a path without a namespace is a type error. The API refuses the same paths at create time.
|
|
73
73
|
|
|
@@ -96,7 +96,7 @@ if (result.ok) {
|
|
|
96
96
|
| Output field | Value |
|
|
97
97
|
| --- | --- |
|
|
98
98
|
| `event` | The verified event body, typed by the endpoint's source. |
|
|
99
|
-
| `headers` | The request headers,
|
|
99
|
+
| `headers` | The request headers, without `authorization`, cookie or shared-secret headers. Headers your `match` uses are always kept; the rest are capped at 4 KB. |
|
|
100
100
|
| `deliveryId` | The delivery that resumed the run (`whd_...`). |
|
|
101
101
|
| `endpoint` | The endpoint the delivery arrived on. |
|
|
102
102
|
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Webhook tasks"
|
|
3
|
+
sidebarTitle: "Webhook tasks"
|
|
4
|
+
description: "What a webhook() handler receives, the task options it takes, how to group deliveries per customer, and the options an endpoint takes."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**A webhook task is a [task](/tasks/overview) with an endpoint attached: `webhook()` starts a task run for each delivery that passes its [filter](/webhooks/filters).** If an attempt fails, the run retries and calls `onEvent` again, so keep its side effects safe to repeat.
|
|
8
|
+
|
|
9
|
+
## Handler arguments
|
|
10
|
+
|
|
11
|
+
`onEvent` receives:
|
|
12
|
+
|
|
13
|
+
| Argument | Value |
|
|
14
|
+
| --- | --- |
|
|
15
|
+
| `event` | The verified request body, parsed as JSON. Its TypeScript type comes from the [source](/webhooks/verification#typing-the-event). |
|
|
16
|
+
| `headers` | Request headers as a Web `Headers` object, with case-insensitive `get()` and `has()` methods. `authorization`, `proxy-authorization`, `cookie`, `set-cookie` and shared-secret headers are removed; other headers, including signature headers such as `stripe-signature`, share a 4 KB budget, so a large set of headers can drop some. Headers a live waiter matches on are always kept. |
|
|
17
|
+
| `endpoint` | The endpoint the delivery arrived on: `id`, `declaredId`, `tenantId`, `externalRef`, and the `metadata` you declared. |
|
|
18
|
+
| `ctx` | The same [run context](/context) that regular tasks receive. |
|
|
19
|
+
|
|
20
|
+
## Task options
|
|
21
|
+
|
|
22
|
+
`webhook()` also takes the options a [task](/tasks/overview) does, such as `queue`, `concurrency`, `machine`, `retry`, `maxDuration` and the lifecycle hooks. For example, to handle one delivery at a time:
|
|
23
|
+
|
|
24
|
+
```ts /trigger/stripe-orders.ts
|
|
25
|
+
import { webhook, webhooks } from "@trigger.dev/sdk";
|
|
26
|
+
|
|
27
|
+
export const stripe = webhooks.endpoint.define({ id: "stripe", source: webhooks.stripe() });
|
|
28
|
+
|
|
29
|
+
export const orders = webhook({
|
|
30
|
+
id: "stripe-orders",
|
|
31
|
+
endpoint: stripe,
|
|
32
|
+
queue: { concurrencyLimit: 1 },
|
|
33
|
+
retry: { maxAttempts: 5 },
|
|
34
|
+
onEvent: async ({ event }) => {
|
|
35
|
+
// ...
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Group deliveries per customer
|
|
41
|
+
|
|
42
|
+
The limit covers every delivery the task handles. To group each customer's events while different customers run in parallel, route them to an agent with [session routing](/webhooks/session-routing): deliveries with the same key land in one session and are handled one at a time. A retried delivery can reach the session after a later one, so don't rely on arrival order.
|
|
43
|
+
|
|
44
|
+
## Endpoint options
|
|
45
|
+
|
|
46
|
+
`webhooks.endpoint.define` also takes a `description` and `metadata`. The metadata is passed to every subscriber as `endpoint.metadata`. The endpoint `id` can't start with `wh_`, which is reserved for the ids Trigger.dev generates.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trigger.dev/sdk",
|
|
3
|
-
"version": "4.8.
|
|
3
|
+
"version": "4.8.6",
|
|
4
4
|
"description": "trigger.dev Node.JS SDK",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"dependencies": {
|
|
78
78
|
"@opentelemetry/api": "1.9.1",
|
|
79
79
|
"@opentelemetry/semantic-conventions": "1.41.1",
|
|
80
|
-
"@trigger.dev/core": "4.8.
|
|
80
|
+
"@trigger.dev/core": "4.8.6",
|
|
81
81
|
"uncrypto": "^0.1.3"
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"@opentelemetry/sdk-trace-base": "2.8.0",
|
|
88
88
|
"@types/react": "^19.2.14",
|
|
89
89
|
"ai": "^6.0.116",
|
|
90
|
-
"ai-v7": "npm:ai@7.0.
|
|
90
|
+
"ai-v7": "npm:ai@7.0.134",
|
|
91
91
|
"rimraf": "^6.0.1",
|
|
92
92
|
"stripe": "23.0.0",
|
|
93
93
|
"tshy": "^4.1.3",
|
|
@@ -240,8 +240,7 @@
|
|
|
240
240
|
"build": "tshy && pnpm run update-version && pnpm run bundle-docs",
|
|
241
241
|
"bundle-docs": "tsx ../../scripts/bundleSdkDocs.ts",
|
|
242
242
|
"dev": "tshy --watch",
|
|
243
|
-
"typecheck": "tsc --noEmit",
|
|
244
|
-
"typecheck:ai-v7": "tsc --noEmit -p tsconfig.ai-v7.json",
|
|
243
|
+
"typecheck": "tsc --noEmit && node scripts/typecheck-ai-majors.mjs",
|
|
245
244
|
"test": "vitest",
|
|
246
245
|
"update-version": "tsx ../../scripts/updateVersion.ts",
|
|
247
246
|
"check-exports": "attw --pack ."
|
|
@@ -1,332 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "Migrating from v3"
|
|
3
|
-
description: "What's new in v4, how to migrate, and breaking changes."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
import NodeVersions from "/snippets/node-versions.mdx";
|
|
7
|
-
import MigrateV4UsingAi from "/snippets/migrate-v4-using-ai.mdx";
|
|
8
|
-
|
|
9
|
-
<Warning>
|
|
10
|
-
**Trigger.dev v3 has been retired**
|
|
11
|
-
|
|
12
|
-
Trigger.dev v3 is end of life. v4 is stable, fully supported, and recommended for all users.
|
|
13
|
-
|
|
14
|
-
- On Trigger.dev Cloud, v3 has been shut down: v3 triggers and deploys no longer run.
|
|
15
|
-
- If you self-host, 4.5.0 is the last version we officially support for running v3. Stay on 4.5.0 or upgrade to v4; 4.5.1 and later reject v3 triggers, batch triggers, and deploys with an upgrade message.
|
|
16
|
-
|
|
17
|
-
**What you need to do:** Migrate to v4. The migration takes about 2 minutes; follow the steps below. If you have questions or need help, [contact us](https://trigger.dev/contact) or reach out in our [Discord](https://trigger.dev/discord).
|
|
18
|
-
|
|
19
|
-
</Warning>
|
|
20
|
-
|
|
21
|
-
## What's new in v4?
|
|
22
|
-
|
|
23
|
-
| Feature | Description |
|
|
24
|
-
| :------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
25
|
-
| [Wait for token](/wait-for-token) | Create and wait for tokens to be completed, enabling approval workflows and waiting for arbitrary external conditions. |
|
|
26
|
-
| Wait idempotency | Skip waits if the same idempotency key is used again when using [wait for](/wait-for#wait-idempotency), [wait until](/wait-until#wait-idempotency), or [wait for token](/wait-for-token#wait-idempotency). |
|
|
27
|
-
| [Priority](/runs/priority) | Specify a priority when triggering a task. |
|
|
28
|
-
| [Global lifecycle hooks](/tasks/overview#global-lifecycle-hooks) | Register global lifecycle hooks that are executed for all runs, regardless of the task. |
|
|
29
|
-
| [onWait and onResume](/tasks/overview#onwait-and-onresume-functions) | Run code when a run is paused or resumed because of a wait. |
|
|
30
|
-
| [onComplete](/tasks/overview#oncomplete-function) | Run code when a run completes, regardless of whether it succeeded or failed. |
|
|
31
|
-
| [onCancel](/tasks/overview#oncancel-function) | Run code when a run is cancelled. |
|
|
32
|
-
| [Hidden tasks](/hidden-tasks) | Create tasks that are not exported from your trigger files but can still be executed. |
|
|
33
|
-
| [Middleware & locals](#middleware-and-locals) | The middleware system runs at the top level, executing before and after all lifecycle hooks. The locals API allows sharing data between middleware and hooks. |
|
|
34
|
-
| [useWaitToken](/realtime/react-hooks/use-wait-token) | Use the useWaitToken hook to complete a wait token from a React component. |
|
|
35
|
-
| [Task-backed AI tools](/tasks/schemaTask#task-backed-ai-tools) | Use `schemaTask` with AI SDK `tool()` and `ai.toolExecute()` (legacy `ai.tool` is deprecated). |
|
|
36
|
-
|
|
37
|
-
## Node.js support
|
|
38
|
-
|
|
39
|
-
<NodeVersions />
|
|
40
|
-
|
|
41
|
-
## How to migrate to v4
|
|
42
|
-
|
|
43
|
-
First read the deprecations and breaking changes sections below.
|
|
44
|
-
|
|
45
|
-
We recommend the following steps to migrate to v4:
|
|
46
|
-
|
|
47
|
-
1. Install the v4 package.
|
|
48
|
-
2. Run the `trigger dev` CLI command and test your tasks locally, fixing any breaking changes.
|
|
49
|
-
3. Deploy to the staging environment and test your tasks in staging, fixing any breaking changes. (this step is optional, but highly recommended)
|
|
50
|
-
4. Once you've verified that v4 is working as expected, you should deploy your application backend with the updated v4 package.
|
|
51
|
-
5. Once you've deployed your application backend, you should deploy your tasks to the production environment.
|
|
52
|
-
|
|
53
|
-
Note that between steps 4 and 5, runs triggered with the v4 package will continue using v3, and only new runs triggered after step 5 is complete will use v4.
|
|
54
|
-
|
|
55
|
-
<Warning>
|
|
56
|
-
Once v4 is activated in your environment, there will be a period of time where old runs will
|
|
57
|
-
continue to execute using v3, while new runs will use v4. Because these engines use completely
|
|
58
|
-
different underlying queues and concurrency models, it's possible you may have up to double the
|
|
59
|
-
amount of concurrently executing runs. Once the runs drain from the old run engine, the
|
|
60
|
-
concurrency will return to normal.
|
|
61
|
-
</Warning>
|
|
62
|
-
|
|
63
|
-
<Note>
|
|
64
|
-
When migrating from v3 to v4, our infrastructure IPs may change. If you use IP allowlisting (e.g. for databases or APIs), [update your allowlists](https://trigger.dev/changelog/static-ips) with the current static IPs before or immediately after switching to v4 to avoid connectivity issues or downtime.
|
|
65
|
-
</Note>
|
|
66
|
-
|
|
67
|
-
## Migrate using AI
|
|
68
|
-
|
|
69
|
-
Use the prompt in the accordion below to help you migrate your v3 tasks to v4. The prompt gives good results when using Claude 4 Sonnet. You’ll need a relatively large token limit.
|
|
70
|
-
|
|
71
|
-
<MigrateV4UsingAi />
|
|
72
|
-
|
|
73
|
-
## Installation
|
|
74
|
-
|
|
75
|
-
To opt-in to using v4, you will need to update your dependencies to the latest version:
|
|
76
|
-
|
|
77
|
-
<CodeGroup>
|
|
78
|
-
|
|
79
|
-
```bash npx
|
|
80
|
-
npx trigger.dev@latest update
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
```bash yarn
|
|
84
|
-
yarn dlx trigger.dev@latest update
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
```bash pnpm
|
|
88
|
-
pnpm dlx trigger.dev@latest update
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
</CodeGroup>
|
|
92
|
-
|
|
93
|
-
This command should update all of your `@trigger.dev/*` packages to a `4.x` version.
|
|
94
|
-
|
|
95
|
-
## Deprecations
|
|
96
|
-
|
|
97
|
-
We've deprecated the following APIs:
|
|
98
|
-
|
|
99
|
-
### @trigger.dev/sdk/v3
|
|
100
|
-
|
|
101
|
-
We've deprecated the `@trigger.dev/sdk/v3` import path and moved to a new path:
|
|
102
|
-
|
|
103
|
-
```ts
|
|
104
|
-
// This still works, but will be removed in a future version
|
|
105
|
-
import { task } from "@trigger.dev/sdk/v3";
|
|
106
|
-
|
|
107
|
-
// This is the new path
|
|
108
|
-
import { task } from "@trigger.dev/sdk";
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
### `handleError` and `init`
|
|
112
|
-
|
|
113
|
-
We've renamed the `handleError` hook to `catchError` to better reflect that it can catch and react to errors. `handleError` will be removed in a future version.
|
|
114
|
-
|
|
115
|
-
`init` was previously used to initialize data used in the run function:
|
|
116
|
-
|
|
117
|
-
```ts
|
|
118
|
-
import { task } from "@trigger.dev/sdk";
|
|
119
|
-
|
|
120
|
-
const myTask = task({
|
|
121
|
-
init: async () => {
|
|
122
|
-
return {
|
|
123
|
-
myClient: new MyClient(),
|
|
124
|
-
};
|
|
125
|
-
},
|
|
126
|
-
run: async (payload: any, { ctx, init }) => {
|
|
127
|
-
const client = init.myClient;
|
|
128
|
-
await client.doSomething();
|
|
129
|
-
},
|
|
130
|
-
});
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
This has now been deprecated in favor of the `locals` API and middleware. See the [Improved middleware and locals](/tasks/overview#middleware-and-locals-functions) section for more details.
|
|
134
|
-
|
|
135
|
-
### toolTask
|
|
136
|
-
|
|
137
|
-
We've deprecated the `toolTask` function, which created both a Trigger.dev task and a tool compatible with the Vercel [AI SDK](https://vercel.com/docs/ai-sdk):
|
|
138
|
-
|
|
139
|
-
```ts
|
|
140
|
-
import { toolTask, schemaTask } from "@trigger.dev/sdk";
|
|
141
|
-
import { z } from "zod";
|
|
142
|
-
import { generateText } from "ai";
|
|
143
|
-
|
|
144
|
-
const myToolTask = toolTask({
|
|
145
|
-
id: "my-tool-task",
|
|
146
|
-
run: async (payload: any, { ctx }) => {},
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
export const myAiTask = schemaTask({
|
|
150
|
-
id: "my-ai-task",
|
|
151
|
-
schema: z.object({
|
|
152
|
-
text: z.string(),
|
|
153
|
-
}),
|
|
154
|
-
run: async (payload, { ctx }) => {
|
|
155
|
-
const { text } = await generateText({
|
|
156
|
-
prompt: payload.text,
|
|
157
|
-
model: openai("gpt-4o"),
|
|
158
|
-
tools: {
|
|
159
|
-
myToolTask,
|
|
160
|
-
},
|
|
161
|
-
});
|
|
162
|
-
},
|
|
163
|
-
});
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
We've replaced the `toolTask` function with `schemaTask` plus AI SDK `tool()` and `ai.toolExecute()` (the older `ai.tool()` wrapper is deprecated). See [Task-backed AI tools](/tasks/schemaTask#task-backed-ai-tools).
|
|
167
|
-
|
|
168
|
-
## Breaking changes
|
|
169
|
-
|
|
170
|
-
### Queue changes
|
|
171
|
-
|
|
172
|
-
Previously, it was possible to specify a queue name of a queue that did not exist, along with a concurrency limit. The queue would then be created "on-demand" with the specified concurrency limit. If the queue did exist, the concurrency limit of the queue would be updated to the specified value:
|
|
173
|
-
|
|
174
|
-
```ts
|
|
175
|
-
await myTask.trigger({ foo: "bar" }, { queue: { name: "my-queue", concurrencyLimit: 10 } });
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
This is no longer possible, and queues must now be defined ahead of time using the `queue` function:
|
|
179
|
-
|
|
180
|
-
```ts
|
|
181
|
-
import { queue } from "@trigger.dev/sdk";
|
|
182
|
-
|
|
183
|
-
const myQueue = queue({
|
|
184
|
-
name: "my-queue",
|
|
185
|
-
concurrencyLimit: 10,
|
|
186
|
-
});
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
Now when you trigger a task, you can only specify the queue by name:
|
|
190
|
-
|
|
191
|
-
```ts
|
|
192
|
-
await myTask.trigger({ foo: "bar" }, { queue: "my-queue" });
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
Or you can set the queue on the task:
|
|
196
|
-
|
|
197
|
-
```ts
|
|
198
|
-
import { queue, task } from "@trigger.dev/sdk";
|
|
199
|
-
|
|
200
|
-
const myQueue = queue({
|
|
201
|
-
name: "my-queue",
|
|
202
|
-
concurrencyLimit: 10,
|
|
203
|
-
});
|
|
204
|
-
|
|
205
|
-
export const myTask = task({
|
|
206
|
-
id: "my-task",
|
|
207
|
-
queue: myQueue,
|
|
208
|
-
run: async (payload: any, { ctx }) => {},
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
// You can optionally specify the queue directly on the task
|
|
212
|
-
export const myTask2 = task({
|
|
213
|
-
id: "my-task-2",
|
|
214
|
-
queue: {
|
|
215
|
-
name: "my-queue-2",
|
|
216
|
-
concurrencyLimit: 50,
|
|
217
|
-
},
|
|
218
|
-
run: async (payload: any, { ctx }) => {},
|
|
219
|
-
});
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
Now you can trigger these tasks without having to specify the queue name in the trigger options:
|
|
223
|
-
|
|
224
|
-
```ts
|
|
225
|
-
await myTask.trigger({ foo: "bar" }); // Will use the queue defined on the task
|
|
226
|
-
await myTask2.trigger({ foo: "bar" }); // Will use the queue defined on the task
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
If you're using `concurrencyKey` you can specify the `queue` and `concurrencyKey` like this:
|
|
230
|
-
|
|
231
|
-
```ts
|
|
232
|
-
const handle = await generatePullRequest.trigger(data, {
|
|
233
|
-
queue: "paid-users",
|
|
234
|
-
concurrencyKey: data.userId,
|
|
235
|
-
});
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
For each unique value of `concurrencyKey`, a new queue will be created using the `concurrencyLimit` from the queue. This allows you to have a queue per user.
|
|
239
|
-
|
|
240
|
-
### Lifecycle hooks
|
|
241
|
-
|
|
242
|
-
We've changed the function signatures of the lifecycle hooks to be more consistent and easier to use, by unifying all the parameters into a single object that can be destructured.
|
|
243
|
-
|
|
244
|
-
Previously, hooks received a payload as the first argument and then an additional object as the second argument:
|
|
245
|
-
|
|
246
|
-
```ts
|
|
247
|
-
import { task } from "@trigger.dev/sdk";
|
|
248
|
-
|
|
249
|
-
export const myTask = task({
|
|
250
|
-
id: "my-task",
|
|
251
|
-
onStart: (payload, { ctx }) => {},
|
|
252
|
-
run: async (payload, { ctx }) => {},
|
|
253
|
-
});
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
Now, all the parameters are passed in a single object:
|
|
257
|
-
|
|
258
|
-
```ts
|
|
259
|
-
import { task } from "@trigger.dev/sdk";
|
|
260
|
-
|
|
261
|
-
export const myTask = task({
|
|
262
|
-
id: "my-task",
|
|
263
|
-
onStart: ({ payload, ctx }) => {},
|
|
264
|
-
// The run function still uses separate parameters
|
|
265
|
-
run: async (payload, { ctx }) => {},
|
|
266
|
-
});
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
This is true for all the lifecycle hooks:
|
|
270
|
-
|
|
271
|
-
```ts
|
|
272
|
-
import { task } from "@trigger.dev/sdk";
|
|
273
|
-
|
|
274
|
-
export const myTask = task({
|
|
275
|
-
id: "my-task",
|
|
276
|
-
onStart: ({ payload, ctx, task }) => {},
|
|
277
|
-
onSuccess: ({ payload, ctx, task, output }) => {},
|
|
278
|
-
onFailure: ({ payload, ctx, task, error }) => {},
|
|
279
|
-
onWait: ({ payload, ctx, task, wait }) => {},
|
|
280
|
-
onResume: ({ payload, ctx, task, wait }) => {},
|
|
281
|
-
onComplete: ({ payload, ctx, task, result }) => {},
|
|
282
|
-
catchError: ({ payload, ctx, task, error, retry, retryAt, retryDelayInMs }) => {},
|
|
283
|
-
run: async (payload, { ctx }) => {},
|
|
284
|
-
});
|
|
285
|
-
```
|
|
286
|
-
|
|
287
|
-
### Context changes
|
|
288
|
-
|
|
289
|
-
We've made a few small changes to the `ctx` object:
|
|
290
|
-
|
|
291
|
-
- `ctx.attempt.id` and `ctx.attempt.status` have been removed. `ctx.attempt.number` is still available.
|
|
292
|
-
- `ctx.task.exportName` has been removed (since we no longer require tasks to be exported to be triggered).
|
|
293
|
-
|
|
294
|
-
### BatchTrigger changes
|
|
295
|
-
|
|
296
|
-
The `batchTrigger` function no longer returns a `runs` list directly. In v3, you could access the runs directly from the batch handle:
|
|
297
|
-
|
|
298
|
-
```ts
|
|
299
|
-
// In v3
|
|
300
|
-
const batchHandle = await tasks.batchTrigger([
|
|
301
|
-
[myTask, { foo: "bar" }],
|
|
302
|
-
[myOtherTask, { baz: "qux" }],
|
|
303
|
-
]);
|
|
304
|
-
|
|
305
|
-
// You could access runs directly
|
|
306
|
-
console.log(batchHandle.runs);
|
|
307
|
-
```
|
|
308
|
-
|
|
309
|
-
In v4, you now need to use the `batch.retrieve()` method to get the batch with its runs:
|
|
310
|
-
|
|
311
|
-
```ts
|
|
312
|
-
// In v4
|
|
313
|
-
const batchHandle = await tasks.batchTrigger([
|
|
314
|
-
[myTask, { foo: "bar" }],
|
|
315
|
-
[myOtherTask, { baz: "qux" }],
|
|
316
|
-
]);
|
|
317
|
-
|
|
318
|
-
// Now you need to retrieve the batch to get the runs
|
|
319
|
-
const batch = await batch.retrieve(batchHandle.batchId);
|
|
320
|
-
console.log(batch.runs);
|
|
321
|
-
```
|
|
322
|
-
|
|
323
|
-
### OpenTelemetry
|
|
324
|
-
|
|
325
|
-
We are now using newer versions of the OpenTelemetry packages. This means that if you're using custom exporters you may need to update the packages:
|
|
326
|
-
|
|
327
|
-
| Package | Previous Version | New Version | Change Type |
|
|
328
|
-
| ----------------------------------------- | ---------------- | ----------- | ------------ |
|
|
329
|
-
| `@opentelemetry/api-logs` | 0.52.1 | 0.203.0 | Major update |
|
|
330
|
-
| `@opentelemetry/exporter-logs-otlp-http` | 0.52.1 | 0.203.0 | Major update |
|
|
331
|
-
| `@opentelemetry/exporter-trace-otlp-http` | 0.52.1 | 0.203.0 | Major update |
|
|
332
|
-
| `@opentelemetry/instrumentation` | 0.52.1 | 0.203.0 | Major update |
|