Title: Azure function - A system error occurred: uv_uptime returned EPERM (operation not permitted) · Issue #8202 · getsentry/sentry-javascript · GitHub
Open Graph Title: Azure function - A system error occurred: uv_uptime returned EPERM (operation not permitted) · Issue #8202 · getsentry/sentry-javascript
X Title: Azure function - A system error occurred: uv_uptime returned EPERM (operation not permitted) · Issue #8202 · getsentry/sentry-javascript
Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using the latest SDK release https://github.com/...
Open Graph Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th...
X Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/8202
X: @github
Domain: github.com
IPv4 address: 140.82.113.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Azure function - A system error occurred: uv_uptime returned EPERM (operation not permitted)","articleBody":"### Is there an existing issue for this?\r\n\r\n- [X] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues\r\n- [X] I have reviewed the documentation https://docs.sentry.io/\r\n- [X] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases\r\n\r\n### How do you use Sentry?\r\n\r\nSentry Saas (sentry.io)\r\n\r\n### Which SDK are you using?\r\n\r\n@sentry/node\r\n\r\n### SDK Version\r\n\r\n7.53.0\r\n\r\n### Framework Version\r\n\r\n_No response_\r\n\r\n### Link to Sentry event\r\n\r\n_No response_\r\n\r\n### SDK Setup\r\n\r\nSentry.init({\r\n dsn: 'the-dsn-here',\r\n tracesSampleRate: 1.0,\r\n environment: process.env.ENVIRONMENT,\r\n});\r\n\r\n\r\n### Steps to Reproduce\r\n\r\n## Problem:\r\nUsing 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.\r\n\r\n## How to reproduce\r\n\r\n- Deploy any code containing the sentry 7.53.0 package to azure functions using nodejs and the given/\"normal\" sentry.init.\r\n- Call `Sentry.captureException(error)` and `await Sentry.flush(2000)`\r\n\r\n## Azure Behaviour for os.uptime\r\n It seems to me that azure functions now have os.uptime defined but one is still not allowed to call the function.\r\nI did a quick print and got:\r\n\r\n\r\n\r\nand in sentry:\r\n\r\n\r\n\r\n\r\nwith the code:\r\n\r\n```ts\r\nconst main = async (context: Context, myBlob: any): Promise\u003cvoid> => {\r\n context.log('logging os.uptime:', os.uptime);\r\n context.log('logging os.uptime():', os.uptime());\r\n...\r\n```\r\n\r\n## Fix?\r\n\r\na) 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\r\nThe code snippet:\r\n```\r\nfunction getDeviceContext(deviceOpt) {\r\n const device = {};\r\n\r\n // os.uptime or its return value seem to be undefined in certain environments (e.g. Azure functions).\r\n // Hence, we only set boot time, if we get a valid uptime value.\r\n // @see https://github.com/getsentry/sentry-javascript/issues/5856\r\n const uptime = os.uptime && os.uptime();\r\n if (typeof uptime === 'number') {\r\n device.boot_time = new Date(Date.now() - uptime * 1000).toISOString();\r\n }\r\n\r\n```\r\nb) Use the fix provided by @joelcollyer [here](https://github.com/getsentry/sentry-javascript/issues/5856#issuecomment-1553753568) by adding the device: false. E.g.\r\n```\r\nSentry.init({\r\n dsn: 'dsn-here',\r\n tracesSampleRate: 1.0,\r\n environment: process.env.ENVIRONMENT,\r\n integrations: [new Sentry.Integrations.Context({ device: false })],\r\n});\r\n\r\n```\r\n\r\n### Expected Result\r\n\r\nThe error that was passed to Sentry.captureException() is captured in sentry\r\n\r\n### Actual Result\r\n\r\nA permission error based on the sentry internal code is captured in sentry","author":{"url":"https://github.com/xddq","@type":"Person","name":"xddq"},"datePublished":"2023-05-24T13:31:56Z","url":"https://github.com/getsentry/sentry-javascript/issues/8202"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:f331e4cc-429f-8f62-8319-4ea508aee697 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D500:225229:318B6C:448E35:6B044D77 |
| html-safe-nonce | d1bb35cf27438431cff267cd931230df94f1585f7f974ef0e5fdbbd54466a0a6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENTAwOjIyNTIyOTozMThCNkM6NDQ4RTM1OjZCMDQ0RDc3IiwidmlzaXRvcl9pZCI6IjI3NDAxNTM0MTk2OTU0MTA1NTEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 72244f3b11e68640216dcdb5cdbb4ac8226397e959fa787ba155eaa64386e165 |
| hovercard-subject-tag | issue:1724008733 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/8202/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f7bac10363cb418126600a1eca779bb7d684ad09c5ced5c49e469cc2b7d35e75/getsentry/sentry-javascript/issues/8202 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f7bac10363cb418126600a1eca779bb7d684ad09c5ced5c49e469cc2b7d35e75/getsentry/sentry-javascript/issues/8202 |
| og:image:alt | Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | xddq |
| hostname | github.com |
| expected-hostname | github.com |
| None | 002aa6b95ffa730b0aec436a5c383f536ad677284e60056037fb120afe37b730 |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3328572 |
| octolytics-dimension-repository_nwo | getsentry/sentry-javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3328572 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-javascript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 059f24c781e3a0d7df3f27a97da0e93fab06ae39 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width