Title: Create ESM Lambda Layer · Issue #12856 · getsentry/sentry-javascript · GitHub
Open Graph Title: Create ESM Lambda Layer · Issue #12856 · getsentry/sentry-javascript
X Title: Create ESM Lambda Layer · Issue #12856 · getsentry/sentry-javascript
Description: (extracted from #12409) Since using the Sentry AWS Serverless SDK is far from easy in ESM-based Lambda functions, we should look into creating a layer for ESM or making our current layer compatible with both, CJS and ESM. I outlined some...
Open Graph Description: (extracted from #12409) Since using the Sentry AWS Serverless SDK is far from easy in ESM-based Lambda functions, we should look into creating a layer for ESM or making our current layer compatible...
X Description: (extracted from #12409) Since using the Sentry AWS Serverless SDK is far from easy in ESM-based Lambda functions, we should look into creating a layer for ESM or making our current layer compatible...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/12856
X: @github
Domain: github.com
IPv4 address: 140.82.112.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Create ESM Lambda Layer","articleBody":"(extracted from [#12409](https://github.com/getsentry/sentry-javascript/issues/12409))\n\nSince using the Sentry AWS Serverless SDK is far from easy in ESM-based Lambda functions, we should look into creating a layer for ESM or making our current layer compatible with both, CJS and ESM.\n\nI outlined some of the prior investigation to this in [#12322](https://github.com/getsentry/sentry-javascript/issues/12322) and [#12409](https://github.com/getsentry/sentry-javascript/issues/12409).\n\nOne major blocker for a code-less Sentry SDK usage like in CJS is that our `tryPatchHandler` function we use to auto-wrap CJS lambda functions can't be applied to ESM Lambda functions (it uses `require` 😢). However, we can create a layer and tell people to manually init the SDK in code. Having the layer is still a huge improvement because users don't have to deploy their node_modules like when installing the SDK via NPM. h/t @andreiborza for pointing this out today!\n\n### ESM Layer v0 (no auto-wrapping)\n\n- [x] [JS-675](https://linear.app/getsentry/issue/4305869f-6c53-4e67-a244-4b8de6c04b85)\n- [x] [JS-670](https://linear.app/getsentry/issue/b5b732f1-5a4b-42d4-bfb5-3230fdc80aa4)\n- [x] [JS-671](https://linear.app/getsentry/issue/c2b8a29d-d849-4d32-83cf-edfde5236e1c)\n- [x] [JS-672](https://linear.app/getsentry/issue/6743c8e2-d534-4fdf-bd55-2e747e31222b)\n- [x] [JS-673](https://linear.app/getsentry/issue/5c47b677-fd1a-4fa9-b963-88c13574c08f)\n- [x] [JS-674](https://linear.app/getsentry/issue/bac90b91-5045-46da-8d65-7b083d4696c9)\n\n### ESM layer v1 (auto-wrapping)\n\n- [x] Investigate why AWS Lambda Otel instrumentation doesn't work in ESM (+ possibly fix it)\n- [x] Find way to auto-wrap handler to permit code-less SDK setup\n- [x] Document code-less SDK setup via environment variables\n\n### Stretch Goals\n\n- [x] Adapt Sentry integration to use ESM version of layer\n- [x] Document how to use Sentry integration for automatic adding of Sentry to (multiple) ESM lambda functions\n- [ ] Look into Supporting SENTRY_DEBUG\n- [ ] Look into the AWS Lambda Extensions API ([https://github.com/getsentry/sentry-javascript/issues/3051#issuecomment-2012577228](https://github.com/getsentry/sentry-javascript/issues/3051#issuecomment-2012577228))","author":{"url":"https://github.com/Lms24","@type":"Person","name":"Lms24"},"datePublished":"2024-07-10T16:37:05Z","url":"https://github.com/getsentry/sentry-javascript/issues/12856"}
| 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:d2617f17-73df-75b4-2849-27d304f05739 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8A3C:17238D:1857781:1F90F12:6B03FA07 |
| html-safe-nonce | 5c6019d442c4fcfa42023a6ebd2f792b6cff0e7f1029a1f4cdb2d7434bc71242 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QTNDOjE3MjM4RDoxODU3NzgxOjFGOTBGMTI6NkIwM0ZBMDciLCJ2aXNpdG9yX2lkIjoiMjQ4ODM3MjY5MTUyMzA3NDU2NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | e64bea132dd37d69da6f676bd40294f1624f671feb6746ed12c6c07a0c703060 |
| hovercard-subject-tag | issue:2401218728 |
| 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/12856/issue_layout |
| twitter:image | https://opengraph.githubassets.com/bb48f43bfdab37c770c483da7444913a944a774949165990359e00cecf3b51e6/getsentry/sentry-javascript/issues/12856 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/bb48f43bfdab37c770c483da7444913a944a774949165990359e00cecf3b51e6/getsentry/sentry-javascript/issues/12856 |
| og:image:alt | (extracted from #12409) Since using the Sentry AWS Serverless SDK is far from easy in ESM-based Lambda functions, we should look into creating a layer for ESM or making our current layer compatible... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Lms24 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| 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 | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| 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