Title: `Sentry.captureCheckIn` not returning · Issue #8311 · getsentry/sentry-javascript · GitHub
Open Graph Title: `Sentry.captureCheckIn` not returning · Issue #8311 · getsentry/sentry-javascript
X Title: `Sentry.captureCheckIn` not returning · Issue #8311 · 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/8311
X: @github
Domain: github.com
IPv4 address: 140.82.112.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`Sentry.captureCheckIn` not returning","articleBody":"### Is there an existing issue for this?\n\n- [X] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues\n- [X] I have reviewed the documentation https://docs.sentry.io/\n- [X] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases\n\n### How do you use Sentry?\n\nSentry Saas (sentry.io)\n\n### Which SDK are you using?\n\n@sentry/sveltekit\n\n### SDK Version\n\n^7.54.0\n\n### Framework Version\n\n\"@sveltejs/kit\": \"^1.20.1\",\n\n### Link to Sentry event\n\n_No response_\n\n### SDK Setup\n\n```ts\r\nSentry.init({\r\n dsn: \"[redacted]\",\r\n tracesSampleRate: 1.0,\r\n debug: true,\r\n});\r\n```\n\n### Steps to Reproduce\n\nI have a \"cron\" job running in my Sveltekit App using [node-cron](https://www.npmjs.com/package/node-cron). I'd like to monitor it using Sentry's cron monitoring feature, but the `Sentry.captureCheckIn` seems to never return and completely blocks the execution of that function... Very strange.\r\n\r\nHere's the Code I'm using:\r\n\r\n```ts\r\n\r\nlet running = false;\r\nfunction jobWrapper() {\r\n console.log(\"Cron job wrapper\");\r\n if (running) {\r\n return;\r\n }\r\n console.log(\"Running cron job\");\r\n const monitorSlug = \"pending-payment-reminders-and-cancellation\";\r\n const checkInId = Sentry.captureCheckIn({\r\n monitorSlug,\r\n status: \"in_progress\",\r\n });\r\n console.log(\"Captured check in\");\r\n\r\n try {\r\n running = true;\r\n console.log(\"About to run cron job\");\r\n checkPendingPaymentActions();\r\n console.log(\"Cron job finished\");\r\n\r\n\r\n running = false;\r\n Sentry.captureCheckIn({\r\n monitorSlug,\r\n checkInId,\r\n status: \"ok\",\r\n });\r\n console.log(\"Captured check in\");\r\n } catch (error) {\r\n running = false;\r\n Sentry.captureCheckIn({\r\n checkInId,\r\n status: \"error\",\r\n monitorSlug,\r\n });\r\n console.log(\"Captured check in with error\");\r\n console.error(error);\r\n }\r\n}\r\n\r\nlet initialized = false;\r\nexport function initializeCron() {\r\n if (initialized) {\r\n return;\r\n }\r\n console.log(\"Initializing cron jobs\");\r\n initialized = true;\r\n\r\n // every 5 minutes\r\n console.log(cron.schedule(\"*/5 * * * *\", jobWrapper))\r\n console.log(\"Scheduled cron job\")\r\n}\r\n```\r\n\r\nSee below for logs\n\n### Expected Result\n\nThe cron status is reported as `in_progress`, then my `checkPendingPaymentActions()` is called and afterwards the status is updated to `ok`.\n\n### Actual Result\n\nLogs:\r\n```\r\nInitializing Sentry...\r\nSentry Logger [log]: Integration installed: InboundFilters\r\nSentry Logger [log]: Integration installed: FunctionToString\r\nSentry Logger [log]: Integration installed: Console\r\nSentry Logger [log]: Integration installed: Http\r\nSentry Logger [log]: Integration installed: Undici\r\nSentry Logger [log]: Integration installed: OnUncaughtException\r\nSentry Logger [log]: Integration installed: OnUnhandledRejection\r\nSentry Logger [log]: Integration installed: ContextLines\r\nSentry Logger [log]: Integration installed: LocalVariables\r\nSentry Logger [log]: Integration installed: Context\r\nSentry Logger [log]: Integration installed: Modules\r\nSentry Logger [log]: Integration installed: RequestData\r\nSentry Logger [log]: Integration installed: LinkedErrors\r\nSentry Logger [log]: Integration installed: RewriteFrames\r\nInitializing cron...\r\nInitializing cron jobs\r\nScheduledTask [...]\r\nScheduled cron job\r\nListening on 0.0.0.0:3000\r\nCron job wrapper\r\nRunning cron job\r\n```\r\nAnd then nothing happens for 5 Minutes, after that, I get:\r\n```\r\nCron job wrapper\r\nRunning cron job\r\n```\r\nIt seems like `Sentry.captureCheckIn` never returns, otherwise `Captured check in` would be logged?\r\n\r\nIf I remove the `Sentry.captureCheckIn` calls, everything works perfectly.\r\n\r\nBy the way, \"normal\" Sentry transaction / performance data is delivered without any issue.\r\n\r\nAny idea? Thanks in advance.","author":{"url":"https://github.com/hrueger","@type":"Person","name":"hrueger"},"datePublished":"2023-06-09T13:57:22Z","url":"https://github.com/getsentry/sentry-javascript/issues/8311"}
| 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:0eaea101-de7e-762f-6b77-cacf641a4b38 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9722:3F7031:287128:37B67C:6B044C26 |
| html-safe-nonce | 50c15cea939677446a2b626742b349caed0052045f14413cce5070c9fc0aeeec |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NzIyOjNGNzAzMToyODcxMjg6MzdCNjdDOjZCMDQ0QzI2IiwidmlzaXRvcl9pZCI6IjcwNTQ1MTY2MTE5MTA0ODcwNzgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | fcd2f4ef7b2063fae3d7fe9e1a633f220ba043b4812bfb2362ae997137c9dc9f |
| hovercard-subject-tag | issue:1749948791 |
| 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/8311/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e9f38249e38f0e054a17d12ecd574c5f0fe52acd7fd2fa069184d3d0ff9171d4/getsentry/sentry-javascript/issues/8311 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e9f38249e38f0e054a17d12ecd574c5f0fe52acd7fd2fa069184d3d0ff9171d4/getsentry/sentry-javascript/issues/8311 |
| 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 | hrueger |
| 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