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
Using nodejs with 7.53.0 (and probably older versions, tested with 7.50) for azure functions crashes with a sentry package specific error when trying to capture an exception.
How to reproduce
Deploy any code containing the sentry 7.53.0 package to azure functions using nodejs and the given/"normal" sentry.init.
Call Sentry.captureException(error) and await Sentry.flush(2000)
Azure Behaviour for os.uptime
It seems to me that azure functions now have os.uptime defined but one is still not allowed to call the function.
I did a quick print and got:
a) Somehow have to fix the check inside @sentry\node\cjs\integrations\context.js in getDeviceContext at line 183:34. It seems that os.uptime is defined in azure function, but calling it still yields the system error. Therefore the current check is not viable
The code snippet:
function getDeviceContext(deviceOpt) {
const device = {};
// os.uptime or its return value seem to be undefined in certain environments (e.g. Azure functions).
// Hence, we only set boot time, if we get a valid uptime value.
// @see https://github.com/getsentry/sentry-javascript/issues/5856
const uptime = os.uptime && os.uptime();
if (typeof uptime === 'number') {
device.boot_time = new Date(Date.now() - uptime * 1000).toISOString();
}
b) Use the fix provided by @joelcollyerhere by adding the device: false. E.g.
Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/node
SDK Version
7.53.0
Framework Version
No response
Link to Sentry event
No response
SDK Setup
Sentry.init({
dsn: 'the-dsn-here',
tracesSampleRate: 1.0,
environment: process.env.ENVIRONMENT,
});
Steps to Reproduce
Problem:
Using nodejs with 7.53.0 (and probably older versions, tested with 7.50) for azure functions crashes with a sentry package specific error when trying to capture an exception.
How to reproduce
Sentry.captureException(error)
andawait Sentry.flush(2000)
Azure Behaviour for os.uptime
It seems to me that azure functions now have os.uptime defined but one is still not allowed to call the function.
I did a quick print and got:
and in sentry:
with the code:
Fix?
a) Somehow have to fix the check inside
@sentry\node\cjs\integrations\context.js in getDeviceContext at line 183:34
. It seems that os.uptime is defined in azure function, but calling it still yields the system error. Therefore the current check is not viableThe code snippet:
b) Use the fix provided by @joelcollyer here by adding the device: false. E.g.
Expected Result
The error that was passed to Sentry.captureException() is captured in sentry
Actual Result
A permission error based on the sentry internal code is captured in sentry
The text was updated successfully, but these errors were encountered: