bug: SDK fails in Supabase Edge (Deno) runtime when calling task.trigger()
Provide environment information
trigger v4.4.1 but also happens with previous versions
Describe the bug
When triggering a task from a Supabase Edge Function using tasks.trigger() (or task.trigger()), the runtime throws:
TypeError: Cannot read properties of undefined (reading 'toString')
at @bugsnag/cuid (fingerprint.mjs).
This only occurs when the SDK is used to trigger; it does not occur when triggering via the REST API (POST to https://api.trigger.dev/api/v1/tasks/<taskId>/trigger).
Expected: Task triggers successfully from the Edge Function using the SDK.
Actual: Runtime error from a dependency that expects Node-style APIs not available in the Supabase Edge (Deno) runtime. Treating as environment compatibility issue; workaround is to use the Tasks API with fetch instead of the SDK (documented in the Supabase Edge Functions guide).
Reproduction repo
n/a
To reproduce
- Follow Triggering tasks from Supabase edge functions.
- In the edge function, use
tasks.trigger()(ortask.trigger()) with the SDK, e.g.import { tasks } from "@trigger.dev/sdk/v3". - Deploy the edge function and invoke it (e.g. hit the function URL or trigger via a DB webhook).
- Observe runtime error:
TypeError: Cannot read properties of undefined (reading 'toString')at@bugsnag/cuidfingerprint.mjs.
Workaround: trigger via the Tasks API with fetch instead of the SDK.
Additional information
No response
Same goes with npm:@trigger.dev/sdk@latest/v3. No luck. Is there any mapping or different path?
this feels less like a generic supabase edge problem and more like one dependency in the sdk path assuming node style runtime APIs. the giveaway is that tasks.trigger() fails but the raw http call works, so the failure looks like sdk-side setup rather than the trigger endpoint itself. i also noticed the earlier proposed fix was around the internal id generation path, which would fit the @bugsnag/cuid stack trace, but since that change was never really carried through i would probably confirm that exact path first before changing docs. if that is the boundary, the safest fix is to swap that dependency for an edge-safe id generator and add one runtime test for deno or supabase edge so this does not regress.
The workaround works for triggers but not for real-time token generation.