mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 01:45:10 +03:00
docs(edge functions): document that sentry needs to be manually flushed before main function returns (#36537)
docs(edge functions): document that sentry needs to be manually flushed before main function returns Resolves #36489
This commit is contained in:
1 parent
5cc2617b5f
commit
7cc64d3bd1
1 file changed
+3
-6
@@ -50,6 +50,8 @@ Deno.serve(async (req) => {
|
||||
return new Response(JSON.stringify(data), { headers: { 'Content-Type': 'application/json' } })
|
||||
} catch (e) {
|
||||
Sentry.captureException(e)
|
||||
// Flush Sentry before the running process closes
|
||||
await Sentry.flush(2000)
|
||||
return new Response(JSON.stringify({ msg: 'error' }), {
|
||||
status: 500,
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
@@ -81,9 +83,4 @@ Find the complete example on [GitHub](https://github.com/supabase/supabase/tree/
|
||||
|
||||
## Working with scopes
|
||||
|
||||
Sentry Deno SDK currently do not support `Deno.serve` instrumentation, which means that there is no scope separation between requests.
|
||||
Because of that, when the Edge Functions runtime is reused between multiple requests, all globally captured breadcrumbs and contextual data
|
||||
will be shared, which is not the desired behavior. To work around this, all default integrations in the example code above are disabled,
|
||||
and you should be relying on [`withScope`](https://docs.sentry.io/platforms/javascript/enriching-events/scopes/#using-withscope) to encapsulate
|
||||
all Sentry SDK API calls, or [pass context directly](https://docs.sentry.io/platforms/javascript/enriching-events/context/#passing-context-directly)
|
||||
to the `captureException` or `captureMessage` calls.
|
||||
Sentry Deno SDK currently do not support `Deno.serve` instrumentation, which means that there is no scope separation between requests. Because of that, when the Edge Functions runtime is reused between multiple requests, all globally captured breadcrumbs and contextual data will be shared, which is not the desired behavior. To work around this, all default integrations in the example code above are disabled, and you should be relying on [`withScope`](https://docs.sentry.io/platforms/javascript/enriching-events/scopes/#using-withscope) to encapsulate all Sentry SDK API calls, or [pass context directly](https://docs.sentry.io/platforms/javascript/enriching-events/context/#passing-context-directly) to the `captureException` or `captureMessage` calls.
|
||||
Reference in new issue
Block a user