Title: Sentry not reporting all errors from AWS Lambda · Issue #15993 · getsentry/sentry-javascript · GitHub
Open Graph Title: Sentry not reporting all errors from AWS Lambda · Issue #15993 · getsentry/sentry-javascript
X Title: Sentry not reporting all errors from AWS Lambda · Issue #15993 · 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/15993
X: @github
Domain: github.com
IPv4 address: 140.82.113.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Sentry not reporting all errors from AWS Lambda","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/node\n\n### SDK Version\n\n9.11.0\n\n### Framework Version\n\n_No response_\n\n### Link to Sentry event\n\n_No response_\n\n### Reproduction Example/SDK Setup\n\n_No response_\n\n### Steps to Reproduce\n\nNode: 18.20.6\n\nConfig\n```js\nconst Sentry = require(\"@sentry/node\");\n\n//...\n\nSentry.init({\n dsn: sentryDsn,\n environment: stage,\n release: APP_VERSION,\n // When enabled, stack traces are automatically attached to all messages logged. This defaults to false.\n attachStacktrace: false,\n // the total amount of breadcrumbs that should be captured. This defaults to 100.\n maxBreadcrumbs: 100,\n debug: true,\n defaultIntegrations: false,\n includeLocalVariables: true,\n integrations: [\n // Capture console logs as breadcrumbs. (default)\n Sentry.consoleIntegration(),\n // Deduplicate certain events to avoid receiving duplicate errors. (default)\n // Sentry.dedupeIntegration(),\n // Add local variables to exception frames. (default)\n Sentry.localVariablesIntegration({ captureAllExceptions: true, }),\n // Allows the SDK to provide original functions and method names, even when\n // those functions or methods are wrapped by our error or breadcrumb handlers. (default)\n Sentry.functionToStringIntegration(),\n // Registers handlers to capture global uncaught exceptions. (default)\n Sentry.onUncaughtExceptionIntegration(),\n // Registers handlers to capture global unhandled promise rejections. (default)\n Sentry.onUnhandledRejectionIntegration(),\n // Extracts all non-native attributes from the error object and attaches them to the event as extra data.\n Sentry.extraErrorDataIntegration(),\n // Allows you to configure linked errors. (default)\n Sentry.linkedErrorsIntegration({limit: 10, key: \"cause\"}),\n // Capture spans & breadcrumbs for http requests. (default)\n Sentry.httpIntegration(),\n // Capture spans & breadcrumbs for node fetch requests. (default)\n Sentry.nativeNodeFetchIntegration(),\n // enable Express.js middleware tracing\n Sentry.expressIntegration(),\n ],\n // Data to be set to the initial scope\n initialScope: {\n tags: {\n \"cu.gitRev\": GIT_REV,\n \"cu.gitTag\": GIT_TAG,\n \"cu.appVersion\": APP_VERSION,\n \"cu.releaseDate\": RELEASE_DATE,\n },\n },\n // Performance Monitoring\n tracesSampleRate: 1.0, // Capture 100% of the transactions\n // Set sampling rate for profiling - this is relative to tracesSampleRate\n profilesSampleRate: 1.0,\n});\n\n// ..\n\n\nconst app = express();\n\n// use middlewares\n// use routes\n\nSentry.setupExpressErrorHandler(app);\n\napp.use((err, req, res, next) => {\n logger.info(\"Error handler start \", err);\n logger.info(`Sentry: ${res.sentry}`);\n if (res.headersSent) {\n return next(err);\n }\n\n const isStatusError = err instanceof StatusError;\n const status = typeof err.status === \"number\" ? err.status : 500;\n const message = isStatusError ? err.message : \"Server error. Please retry.\";\n\n if (status >= 500) {\n console.error(err);\n }\n\n if (err instanceof ValidationError) {\n res.status(err.statusCode).json(err);\n return res.end();\n }\n\n res.status(status).json({\n ...(isStatusError ? err : {}),\n message: message,\n });\n return res.end();\n});\n\nconst handler = serverless(app, { binary: [\"application/pdf\"] });\n// ...\n```\n\nsample testing endpoints in passed to Express.js router:\n```js\nr.get(\"/api/status\", (req, res) => res.status(200).json({ status: \"api-v2 up\" }));\nr.get(\"/api/throw\", async () => {\n const someVariable = \"contains some value\";\n console.log(\"test log from Console\");\n logger.info(`variable value: ${someVariable}`);\n throw new Error(`Sentry test! ${moment().utc().format()}`);\n});\nr.post(\"/api/throw2\", async (req, res) => {\n const { msg } = req.body;\n throw new Error(`${msg} ${moment().utc().format()}`);\n});\n```\n\n### Expected Result\n\nAll errors getting reported to Sentry.\n\n### Actual Result\n\nNot all errors are reported to Sentry.\n\nI set `debug: true` in options and I noticed these:\n\n```\n2025-04-07T10:31:37.648000+00:00 2025/04/07/[$LATEST]17f2b086d6674e16a9ca0fc0dc3509e3 2025-04-07T10:31:37.648Z 1212eb8a-f7c5-4239-841d-2ea330a15875 DEBUG Sentry Logger [debug]: @opentelemetry_sentry-patched/instrumentation-http outgoingRequest on request error() Error: socket hang up \n at connResetException (node:internal/errors:720:14) \n at TLSSocket.socketOnEnd (node:_http_client:525:23) \n at TLSSocket.emit (node:events:529:35) \n at TLSSocket.emit (node:domain:489:12) \n at endReadableNT (node:internal/streams/readable:1400:12) \n at process.processTicksAndRejections (node:internal/process/task_queues:82:21) { \n code: 'ECONNRESET' \n} \n2025-04-07T10:31:37.687000+00:00 2025/04/07/[$LATEST]17f2b086d6674e16a9ca0fc0dc3509e3 2025-04-07T10:31:37.687Z 1212eb8a-f7c5-4239-841d-2ea330a15875 INFO Sentry Logger [log]: Recording outcome: \"network_error:error\" \n2025-04-07T10:31:37.705000+00:00 2025/04/07/[$LATEST]17f2b086d6674e16a9ca0fc0dc3509e3 2025-04-07T10:31:37.705Z 1212eb8a-f7c5-4239-841d-2ea330a15875 ERROR Sentry Logger [error]: Error while sending envelope: Error: socket hang up \n at connResetException (node:internal/errors:720:14) \n at TLSSocket.socketOnEnd (node:_http_client:525:23) \n at TLSSocket.emit (node:events:529:35) \n at TLSSocket.emit (node:domain:489:12) \n at endReadableNT (node:internal/streams/readable:1400:12) \n at process.processTicksAndRejections (node:internal/process/task_queues:82:21) { \n code: 'ECONNRESET' \n} \n```\n[fulllog.txt](https://github.com/user-attachments/files/19630832/fulllog.txt)\n\nFor scenario where I call /api/throw, then /api/throw2 and /api/status.\n\nThe first error got though, the second error is not reported.\n\nWhile I've been testing it today on a deployed lambda, Sentry seems to drop more events then pass through. And it is not they are not accepted - they are not reaching to the Sentry server. The project it belongs are still running low numbers - in stats I see, on total of 16 error, 16 got accepted, but there should be more then 16 errors reported.\n\nThese logs come from SDK 9.11.0, but I tested with v8 and I got similar results.\nThe code runs on AWS Lambda.","author":{"url":"https://github.com/rynkowsg","@type":"Person","name":"rynkowsg"},"datePublished":"2025-04-07T11:06:52Z","url":"https://github.com/getsentry/sentry-javascript/issues/15993"}
| 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:33a12c53-e5b4-856e-e3e2-24e4ac2c9750 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EBB6:386E70:27CD1:34198:6B0757A9 |
| html-safe-nonce | 280aa956f8dee3c8805b17d6c8e8ceabdfed9382654a76a8eb6cfb292ce8ebf9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQkI2OjM4NkU3MDoyN0NEMTozNDE5ODo2QjA3NTdBOSIsInZpc2l0b3JfaWQiOiI3MzYyODI2NzkzMzk0ODUzODAxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | b03894ae7547ea46fb49bd767bc1de5434bd2a31981970d4abcd1bdde297680f |
| hovercard-subject-tag | issue:2976489427 |
| 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/15993/issue_layout |
| twitter:image | https://opengraph.githubassets.com/bc7305825017b921444b32b1b14b0ee4e665524ea18fe272b38cf819942dddac/getsentry/sentry-javascript/issues/15993 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/bc7305825017b921444b32b1b14b0ee4e665524ea18fe272b38cf819942dddac/getsentry/sentry-javascript/issues/15993 |
| 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 | rynkowsg |
| hostname | github.com |
| expected-hostname | github.com |
| None | e8a742cfa7d479a227a6a6e03ec8d1b3f77f746d4752d7d11136b478718b9658 |
| 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 | 7bda31a5f68d83542e3adebba328d48747c5f604 |
| 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