Title: Errors not sent when using an AWS lambda with a http proxy and the sentry lambda layer · Issue #17804 · getsentry/sentry-javascript · GitHub
Open Graph Title: Errors not sent when using an AWS lambda with a http proxy and the sentry lambda layer · Issue #17804 · getsentry/sentry-javascript
X Title: Errors not sent when using an AWS lambda with a http proxy and the sentry lambda layer · Issue #17804 · 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/17804
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Errors not sent when using an AWS lambda with a http proxy and the sentry lambda layer","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\n10.15.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\nhttps://github.com/callumgare/sentry-lambda-http-proxy-issue/tree/http-proxy-issue (note when cloning this is not the default branch so you'll have to also checkout the \"http-proxy-issue\" branch)\n\n### Steps to Reproduce\n\nDeploy the stack in the reproduction repo above using the instructions in the README.\n\nThere should be 2 lambda urls printed in the console. Both lambdas are identical except one loads \"@sentry/aws-serverless\" from the Sentry's AWS lambda layer and other other from NPM. Send a request to each and for each one observe whether the error is received by sentry or not.\n\n### Expected Result\n\nBoth lambdas should result in sentry receiving an error.\n\n### Actual Result\n\nThe lambda which is setup to use load \"@sentry/aws-serverless\" from the Sentry AWS lambda layer does not successfully send the thrown error to sentry. However the other lambda, which uses \"@sentry/aws-serverless\" via npm installation instead of a lambda layer does send the error.\n\nIn the CloudWatch logs for the lambda layer based lambda the following is output:\n```\nSentry Logger [log]: [https-proxy-agent] Creating `net.Socket`: %o { ALPNProtocols: [ 'http/1.1' ], host: '10.0.138.88', port: 3128 }\nSentry Logger [log]: [https-proxy-agent:parse-proxy-response] got proxy server response: %o %o HTTP/1.1 403 Forbidden {\nserver: 'squid/6.13',\n'mime-version': '1.0',\ndate: 'Mon, 29 Sep 2025 03:23:10 GMT',\n'content-type': 'text/html;charset=utf-8',\n'content-length': '3490',\n'x-squid-error': 'ERR_ACCESS_DENIED 0',\nvary: 'Accept-Language',\n'content-language': 'en',\n'cache-status': 'ip-10-0-138-88.ap-southeast-2.compute.internal',\nvia: '1.1 ip-10-0-138-88.ap-southeast-2.compute.internal (squid/6.13)',\nconnection: 'close'\n}\nSentry Logger [log]: [https-proxy-agent] Replaying proxy buffer for failed request\n```\n\nBut in the logs for the npm based lambda this is output instead:\n```\nSentry Logger [log]: [https-proxy-agent] Creating `net.Socket`: %o { ALPNProtocols: [ 'http/1.1' ], host: '10.0.138.88', port: 3128 }\nSentry Logger [log]: [https-proxy-agent:parse-proxy-response] got proxy server response: %o %o HTTP/1.1 200 Connection established \n{}\n\nSentry Logger [log]: [https-proxy-agent] Upgrading socket connection to TLS\n```\n\n### Additional Context\n\nI believe the issue is connected to the fact that when \"@sentry/aws-serverless\" is imported from the Sentry AWS Lambda [getSDKSource()](https://github.com/getsentry/sentry-javascript/blob/0e196737dbfdd9bb14dd1920b5146f80dadb02f4/packages/core/src/utils/env.ts#L32) returns \"aws-lambda-layer\" due to [this](https://github.com/getsentry/sentry-javascript/blob/0e196737dbfdd9bb14dd1920b5146f80dadb02f4/packages/aws-serverless/scripts/buildLambdaLayer.ts#L208) but when \"@sentry/aws-serverless\" is imported from the npm installed module `getSDKSource()` will return \"npm\".\n\nWhen `getSDKSource()` returns \"aws-lambda-layer\" then `useLayerExtension` will be true [here](https://github.com/getsentry/sentry-javascript/blob/0e196737dbfdd9bb14dd1920b5146f80dadb02f4/packages/aws-serverless/src/init.ts#L33). This results in the `tunnel` being set to \"http://localhost:9000/envelope\" [here](https://github.com/getsentry/sentry-javascript/blob/0e196737dbfdd9bb14dd1920b5146f80dadb02f4/packages/aws-serverless/src/init.ts#L41). That would be fine except because we're a http proxy sentry will send a request to the http proxy to be forwarded to \"http://localhost:9000/envelope\". If that proxy is on a different machine (which is likely for a http proxy since they're normally used at the edge of a network to control what traffic goes in and out) then \"localhost\" will refer to the machine that the proxy is running on and thus fail to reach the tunnel created by sentry.\n\n### Possible Fixes\nIdeally the request would be proxied after it passes though the tunnel rather than before but another option might be to just not turn the lambda extension on by default if a http proxy is used.\n\n\u003csub>Tip: React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding `+1` or `me too`, to help us triage it.\u003c/sub>","author":{"url":"https://github.com/callumgare","@type":"Person","name":"callumgare"},"datePublished":"2025-09-29T04:12:16Z","url":"https://github.com/getsentry/sentry-javascript/issues/17804"}
| 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:c50ae2ef-a1d7-7e0f-92f5-63fbc75d97f0 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9712:1760D:F806C9:144344E:6B04ED4C |
| html-safe-nonce | 164f37a9db0aa97c37512e8d939bcddca6facdb6c5748366dfa60f21761886d7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NzEyOjE3NjBEOkY4MDZDOToxNDQzNDRFOjZCMDRFRDRDIiwidmlzaXRvcl9pZCI6IjkxOTA5MDk4MjExMjg2MDA5MDgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 8b16effa92d8e0894742cbab6f7bbc6c293d677894550fe5b99f369c54ffbc93 |
| hovercard-subject-tag | issue:3463146202 |
| 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/17804/issue_layout |
| twitter:image | https://opengraph.githubassets.com/68854063fad281ea64da770cdf6149726763b052ffd3847694fae1eeb34d6a14/getsentry/sentry-javascript/issues/17804 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/68854063fad281ea64da770cdf6149726763b052ffd3847694fae1eeb34d6a14/getsentry/sentry-javascript/issues/17804 |
| 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 | callumgare |
| hostname | github.com |
| expected-hostname | github.com |
| None | f3851aad500d8e8dce736722ddc6fa9596e17d9fce3c53581eba968664c0bc32 |
| 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 | e29c922455fd8137f27e1cfcdf6a1e8b920b1926 |
| 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