Title: aws-serverless + SST: LocalVariables integration / its usage of Node Inspector kills lambda functions and floods Sentry issues · Issue #14524 · getsentry/sentry-javascript · GitHub
Open Graph Title: aws-serverless + SST: LocalVariables integration / its usage of Node Inspector kills lambda functions and floods Sentry issues · Issue #14524 · getsentry/sentry-javascript
X Title: aws-serverless + SST: LocalVariables integration / its usage of Node Inspector kills lambda functions and floods Sentry issues · Issue #14524 · 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/14524
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"aws-serverless + SST: LocalVariables integration / its usage of Node Inspector kills lambda functions and floods Sentry issues","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/aws-serverless\n\n### SDK Version\n\n8.41.0\n\n### Framework Version\n\n_No response_\n\n### Link to Sentry event\n\nhttps://addcraft.sentry.io/issues/5987124956\n\n### Reproduction Example/SDK Setup\n\nWe've set up Sentry according to the [NPM Package - ESM method](https://docs.sentry.io/platforms/javascript/guides/aws-lambda/install/esm-npm/) in the docs. We are using SST v3.3.30.\n\nSentry is setup in a `sentry.ts` file:\n\n```\n/**\n * This file initializes Sentry. It has to be an own file so it is loaded before any other module.\n * The loading happens via NODE_OPTIONS in the infra/Helpers.ts file.\n * \n * For more information, see https://docs.sentry.io/platforms/javascript/guides/aws-lambda/install/esm-npm/\n * This file is compiled into config/sentry-loader.js by running `npm run build-sentry-loader`.\n * This is done automatically on npm postinstall event.\n */\n\nimport * as Sentry from \"@sentry/aws-serverless\";\n\nconsole.log(\"Initializing Sentry for DSN \"+process.env.SENTRY_DSN);\n\nSentry.init({\n enabled: !!process.env.SENTRY_DSN,\n dsn: process.env.SENTRY_DSN,\n release: process.env.PLUGIN_VERSION || \"0.1.0-SNAPSHOT\",\n environment: process.env.PRESENTER_STAGE || \"local\",\n\n enableTracing: true,\n \n // Keep it on 1.0 on prod for now\n tracesSampleRate: 1.0,\n\n // Profiling Sample Rate 1 for now\n profilesSampleRate: 1.0,\n\n includeLocalVariables: true\n});\n```\n\nAs described in the code comment above, we compile this .ts file to .js on build time:\n\n```\nconst esbuild = require('esbuild');\n\nesbuild.build({\n entryPoints: ['src/sentry.ts'],\n bundle: true,\n platform: 'node',\n target: 'node18',\n outfile: 'config/sentry-loader.js',\n format: 'cjs'\n});\n```\n\nThe created `sentry-loader.js` is referenced in the lambda definition of the SST endpoint:\n\n```\nexport const backendApi = new sst.aws.ApiGatewayV2(\"BackendApi\", {\n domain: \"api.myapp.com\"\n});\n\nbackendApi.route(\"$default\", {\n handler: \"src/index.handler\",\n runtime: \"nodejs20.x\", // This was \"nodejs18.x\" before, see actual result for details\n timeout: \"30 seconds\",\n copyFiles: [\n { from: \"./config\" },\n { from: \"./src/views\" }\n ],\n environment: {\n DEPLOYED_REGION: aws.getRegionOutput().name,\n NODE_ENV: process.env.NODE_ENV || \"development\",\n PLUGIN_VERSION: process.env.PLUGIN_VERSION || \"0.0.0\",\n\n // Sentry configuration\n SENTRY_DSN: process.env.SENTRY_DSN || \"\",\n NODE_OPTIONS: \"--import ./config/sentry-loader.js\",\n SENTRY_TRACES_SAMPLE_RATE: \"1.0\"\n }\n link: [\n // Some boring dynamodb tables etc.\n ]\n});\n```\n\n### Steps to Reproduce\n\nSetup a SST project with a sentry ESM loader as explained above and deploy to production.\n\n### Expected Result\n\nSentry logs errors and causes no problems.\n\n### Actual Result\n\nThe results differ between runtime versions (I assume - we've upgraded the runtime version along with a big bunch of NPM packages, including Sentry, going from 8.33.1 to 8.41.0, and I don't want to use the production environment to isolate the problem :)).\n\n**With runtime \"nodejs20.x\":**\n\nThe lambda function does not start up at all, resulting in HTTP 503s after 30 seconds. The CloudWatch logs say: \n\n```\nInitializing Sentry for DSN https://[redacted]@[redacted].ingest.us.sentry.io/[redacted]\nDebugger listening on ws://127.0.0.1:39651/3c7e36e4-ec77-4846-a745-7f5f5759e85f\nFor help, see: https://nodejs.org/en/docs/inspector\nDebugger listening on ws://127.0.0.1:37035/481827cc-e29d-420a-9d45-8bb57a07511b\nFor help, see: https://nodejs.org/en/docs/inspector\nDebugger listening on ws://127.0.0.1:36793/4cb1457e-a94c-406f-8006-80bddf296d28\nFor help, see: https://nodejs.org/en/docs/inspector\n[... some dozens more ...]\nDebugger listening on ws://127.0.0.1:38873/d5df3f49-ee27-41b7-b8dd-09ef21cb3c42\nFor help, see: https://nodejs.org/en/docs/inspector\nDebugger listening on ws://127.0.0.1:38959/5191a315-bc8e-493e-b196-e2cdafded6d1\nFor help, see: https://nodejs.org/en/docs/inspector\nDebugger listening on ws://127.0.0.1:45543/100f3533-56d2-476c-babc-b19a2a203d3a\nFor help, see: https://nodejs.org/en/docs/inspector\nINIT_REPORT Init Duration: 30000.64 ms\tPhase: invoke\tStatus: timeout\n```\n\n**With runtime \"nodejs18.x\"**\n\nThe application works as expected, but the Sentry issues are flooded with thousands (!) of issues affecting 0 users looking like that:\n\n```\n{\n \"event_id\": \"d3234489202f43dca677175e8bf3fd5d\",\n \"project\": [redacted],\n \"release\": \"[redacted]\",\n \"dist\": null,\n \"platform\": \"node\",\n \"message\": \"\",\n \"datetime\": \"2024-11-27T16:38:44+00:00\",\n \"tags\": [\n [\n \"environment\",\n \"production\"\n ],\n [\n \"handled\",\n \"no\"\n ],\n [\n \"level\",\n \"error\"\n ],\n [\n \"mechanism\",\n \"onunhandledrejection\"\n ],\n [\n \"os.name\",\n \"Linux\"\n ],\n [\n \"runtime\",\n \"node v20.18.0\"\n ],\n [\n \"runtime.name\",\n \"node\"\n ],\n [\n \"release\",\n \"[redacted]\"\n ],\n [\n \"server_name\",\n \"[redacted]\"\n ]\n ],\n \"_dsc\": {\n \"environment\": \"[redacted]\",\n \"public_key\": \"[redacted]\",\n \"release\": \"[redacted]\",\n \"replay_id\": null,\n \"trace_id\": \"[redacted]\",\n \"transaction\": null\n },\n \"_metrics\": {\n \"bytes.ingested.event\": 2792,\n \"bytes.stored.event\": 5297\n },\n \"contexts\": {\n \"app\": {\n \"app_start_time\": \"2024-11-27T16:38:28.640Z\",\n \"app_memory\": 582651904,\n \"free_memory\": 525627392,\n \"type\": \"app\"\n },\n \"cloud_resource\": {\n \"cloud.platform\": \"AWS_Lambda_nodejs20.x\",\n \"cloud.provider\": \"aws\",\n \"cloud.region\": \"eu-central-1\",\n \"type\": \"cloud_resource\"\n },\n \"culture\": {\n \"locale\": \"en-US\",\n \"timezone\": \"UTC\",\n \"type\": \"culture\"\n },\n \"device\": {\n \"arch\": \"x64\",\n \"memory_size\": 1249615872,\n \"free_memory\": 525627392,\n \"boot_time\": \"2024-11-27T16:36:44.205Z\",\n \"processor_count\": 2,\n \"cpu_description\": \"Intel(R) Xeon(R) Processor @ 2.50GHz\",\n \"processor_frequency\": 0,\n \"type\": \"device\"\n },\n \"os\": {\n \"name\": \"Linux\",\n \"kernel_version\": \"5.10.227-239.884.amzn2.x86_64\",\n \"type\": \"os\"\n },\n \"runtime\": {\n \"runtime\": \"node v20.18.0\",\n \"name\": \"node\",\n \"version\": \"v20.18.0\",\n \"type\": \"runtime\"\n },\n \"trace\": {\n \"trace_id\": \"[redacted]\",\n \"span_id\": \"b194994bab6ec9c4\",\n \"status\": \"unknown\",\n \"type\": \"trace\"\n }\n },\n \"culprit\": \"#onMessage(node:inspector)\",\n \"environment\": \"production-de\",\n \"exception\": {\n \"values\": [\n {\n \"type\": \"Error\",\n \"value\": \"Inspector error -32000: Could not find object with given id\",\n \"stacktrace\": {\n \"frames\": [\n {\n \"function\": \"AsyncResource.runMicrotask\",\n \"module\": \"task_queues\",\n \"filename\": \"node:internal/process/task_queues\",\n \"abs_path\": \"node:internal/process/task_queues\",\n \"lineno\": 137,\n \"colno\": 8,\n \"in_app\": false\n },\n {\n \"function\": \"AsyncResource.runInAsyncScope\",\n \"module\": \"node:async_hooks\",\n \"filename\": \"node:async_hooks\",\n \"abs_path\": \"node:async_hooks\",\n \"lineno\": 206,\n \"colno\": 9,\n \"in_app\": false\n },\n {\n \"module\": \"task_queues\",\n \"filename\": \"node:internal/process/task_queues\",\n \"abs_path\": \"node:internal/process/task_queues\",\n \"lineno\": 140,\n \"colno\": 7,\n \"in_app\": false\n },\n {\n \"module\": \"node:inspector\",\n \"filename\": \"node:inspector\",\n \"abs_path\": \"node:inspector\",\n \"lineno\": 75,\n \"colno\": 58,\n \"in_app\": false\n },\n {\n \"function\": \"#onMessage\",\n \"module\": \"node:inspector\",\n \"filename\": \"node:inspector\",\n \"abs_path\": \"node:inspector\",\n \"lineno\": 87,\n \"colno\": 15,\n \"in_app\": false\n }\n ]\n },\n \"mechanism\": {\n \"type\": \"onunhandledrejection\",\n \"handled\": false\n }\n }\n ]\n },\n \"extra\": {\n \"unhandledPromiseRejection\": true\n },\n \"fingerprint\": [\n \"{{ default }}\"\n ],\n \"grouping_config\": {\n \"enhancements\": \"KLUv_SAYwQAAkwKRs25ld3N0eWxlOjIwMjMtMDEtMTGQ\",\n \"id\": \"newstyle:2023-01-11\"\n },\n \"hashes\": [\n \"[redacted]\"\n ],\n \"ingest_path\": [\n {\n \"version\": \"24.11.1\",\n \"public_key\": \"[redacted]\"\n }\n ],\n \"key_id\": \"3799414\",\n \"level\": \"error\",\n \"location\": \"node:inspector\",\n \"logger\": \"\",\n \"metadata\": {\n \"filename\": \"node:inspector\",\n \"function\": \"#onMessage\",\n \"in_app_frame_mix\": \"system-only\",\n \"type\": \"Error\",\n \"value\": \"Inspector error -32000: Could not find object with given id\"\n },\n \"nodestore_insert\": 1732725526.58189,\n \"received\": 1732725524.25593,\n \"sdk\": {\n \"name\": \"sentry.javascript.aws-serverless\",\n \"version\": \"8.33.1\",\n \"integrations\": [\n \"InboundFilters\",\n \"FunctionToString\",\n \"LinkedErrors\",\n \"RequestData\",\n \"Console\",\n \"Http\",\n \"NodeFetch\",\n \"OnUncaughtException\",\n \"OnUnhandledRejection\",\n \"ContextLines\",\n \"LocalVariablesAsync\",\n \"Context\",\n \"Modules\",\n \"Aws\",\n \"AwsLambda\",\n \"AWSLambda\"\n ],\n \"packages\": [\n {\n \"name\": \"npm:@sentry/aws-serverless\",\n \"version\": \"8.33.1\"\n }\n ]\n },\n \"timestamp\": 1732725524.164,\n \"title\": \"Error: Inspector error -32000: Could not find object with given id\",\n \"type\": \"error\",\n \"version\": \"7\"\n}\n```\n\n**Workaround**\n\nDisabling `includeLocalVariables` ends the pain - the lambda loads as expected again.\n","author":{"url":"https://github.com/steffen-mueller","@type":"Person","name":"steffen-mueller"},"datePublished":"2024-11-28T14:32:26Z","url":"https://github.com/getsentry/sentry-javascript/issues/14524"}
| 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:894eca78-e2d1-af0e-dfd2-260b90f77e53 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9FBC:1F2F:348EC7:46D28B:6B042FC2 |
| html-safe-nonce | f20a6e161eabb34e6622230c9ccb5bb33626ef6d349325373db14431bad84a66 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RkJDOjFGMkY6MzQ4RUM3OjQ2RDI4Qjo2QjA0MkZDMiIsInZpc2l0b3JfaWQiOiI4NDE5MTM2MjY0MjYzMTg0MzIyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | a07c0ea6782440d7d9d6bfedf6f70601ba5b5e7d1de629a14a292461f7e07a36 |
| hovercard-subject-tag | issue:2702342778 |
| 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/14524/issue_layout |
| twitter:image | https://opengraph.githubassets.com/249749e73e6246ca1bc5a26fcea163cf8ad83b135c4b2b491fc8fa68ed51d57e/getsentry/sentry-javascript/issues/14524 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/249749e73e6246ca1bc5a26fcea163cf8ad83b135c4b2b491fc8fa68ed51d57e/getsentry/sentry-javascript/issues/14524 |
| 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 | steffen-mueller |
| hostname | github.com |
| expected-hostname | github.com |
| None | b7a1d2b9101496921b08579fbee988d014345aef2f5bd660d1f8c7332d81560e |
| 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 | c3dd496c3da6ea6b77e69c09279d2b81604654f1 |
| 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