You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Added in the Sentry code above (I originally followed the installation steps in Sentry itself and on Supabase's website but I realised its outdated as the deno.land package is depreciated. I am now using the npm install as in the code above
Trigger the edge function
Note:
6. If this: setTimeout(() => { throw new Error(); }); is not in there, the messages above work and send through (like the 'Good bye' and 'Hello world'. If it is in there however, I get the logs appearing in supabase edge function until that point, then I get the error. I do not get any of the Good bye or Hellp world ones.
Expected Result
That this error would come up in sentry runtime and adding in this error (the example error) wouldn't stop any of the errors from going to sentry.
It is not however. I do see the error in the edgefunctions logs on supabase but not anywhere else.
Note I can see results from eg:
Sentry.captureException(new Error("Good bye"));
or
Sentry.captureMessage("Hello, world!");
Note this may be the expected behaviour and the setTimeout(() => { throw new Error(); }); might not be meant to throw an error picked up here - but that it is not working shows maybe it wont pick up other errors in here either....
Actual Result
Nothing comes up in Sentry.
This is the log for the error in the supabase edge function logs:
Hey, thanks for writing in. Is the issue only happening inside of setTimeout calls? If so, I would assume it is simply due to timing issues and things happening outside of the thread 🤔 Like, at the point that the timeout function is called, the response has already been sent, and possibly Sentry doesn't catch stuff anymore then.
I believe you need to wrap the content of your setTimeout callback in try-catch itself, then it should work - a bit manual, but you can possibly extract this into a utility:
Thank you for the response! Yes that works! Thank you! It was within a try catch block but will try and make them smaller to ensure it captures them properly
Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/deno
SDK Version
Framework Version
Deno with Supabase
Link to Sentry event
No response
Reproduction Example/SDK Setup
Steps to Reproduce
Note:
6. If this:
setTimeout(() => { throw new Error(); });
is not in there, the messages above work and send through (like the 'Good bye' and 'Hello world'. If it is in there however, I get the logs appearing in supabase edge function until that point, then I get the error. I do not get any of the Good bye or Hellp world ones.Expected Result
That this error would come up in sentry runtime and adding in this error (the example error) wouldn't stop any of the errors from going to sentry.
It is not however. I do see the error in the edgefunctions logs on supabase but not anywhere else.
Note I can see results from eg:
Sentry.captureException(new Error("Good bye"));
or
Sentry.captureMessage("Hello, world!");
Note this may be the expected behaviour and the setTimeout(() => { throw new Error(); }); might not be meant to throw an error picked up here - but that it is not working shows maybe it wont pick up other errors in here either....
Actual Result
Nothing comes up in Sentry.
This is the log for the error in the supabase edge function logs:
{
"event_message": "event loop error: Error: test\n at file:///Users/a/Documents/Automations/supabase-edge-functions/supabase/functions/pilot2email/index.ts:50:13\n at eventLoopTick (ext:core/01_core.js:203:13)",
"id": "33341939-735b-4c14-89ae-dc707dc284f0",
"metadata": [
{
"boot_time": null,
"cpu_time_used": null,
"deployment_id": "cmhsbvzpocwhojvycyin_ca0f2255-4455-42b7-8ca6-4c4ef8284b7f_16",
"event_type": "UncaughtException",
"execution_id": "506ce836-5122-4273-a7d7-ea1b7f34b2f3",
"function_id": "ca0f2255-4455-42b7-8ca6-4c4ef8284b7f",
"level": "error",
"memory_used": [],
"project_ref": "cmhsbvzpocwhojvycyin",
"reason": null,
"region": "ap-southeast-2",
"served_by": "supabase-edge-runtime-1.66.5 (compatible with Deno v1.45.2)",
"timestamp": "2025-01-30T04:59:09.683Z",
"version": "16"
}
],
"timestamp": 1738213153590102
}
The text was updated successfully, but these errors were encountered: