Skip to content

Commit 24b92d3

Browse files
authored
docs: added runtime error note for supabase edge function (#3140)
1 parent 8003923 commit 24b92d3

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

docs/guides/frameworks/supabase-edge-functions-basic.mdx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,4 +192,24 @@ Check your [cloud.trigger.dev](http://cloud.trigger.dev) dashboard and you shoul
192192
</Step>
193193
</Steps>
194194

195+
### If you see a runtime error when calling tasks.trigger()
196+
197+
If you see `TypeError: Cannot read properties of undefined (reading 'toString')` when calling `tasks.trigger()` from your edge function, the SDK is hitting a dependency that expects Node-style APIs not available in the Supabase Edge (Deno) runtime. Use the [Tasks API](/management/tasks/trigger) with `fetch` instead of the SDK—that avoids loading the SDK in Deno:
198+
199+
```ts
200+
const response = await fetch(
201+
`https://api.trigger.dev/api/v1/tasks/your-task-id/trigger`,
202+
{
203+
method: "POST",
204+
headers: {
205+
Authorization: `Bearer ${Deno.env.get("TRIGGER_SECRET_KEY")}`,
206+
"Content-Type": "application/json",
207+
},
208+
body: JSON.stringify({ payload: { your: "payload" } }),
209+
}
210+
);
211+
```
212+
213+
See [Trigger task via API](/management/tasks/trigger) for full request/response details and optional fields (e.g. `delay`, `idempotencyKey`).
214+
195215
<SupabaseDocsCards />

0 commit comments

Comments
 (0)