Skip to content

Create ESM Lambda Layer #12856

Description

@Lms24

(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 of the prior investigation to this in #12322 and #12409.

One 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!

ESM Layer v0 (no auto-wrapping)

ESM layer v1 (auto-wrapping)

  • Investigate why AWS Lambda Otel instrumentation doesn't work in ESM (+ possibly fix it)
  • Find way to auto-wrap handler to permit code-less SDK setup
  • Document code-less SDK setup via environment variables

Stretch Goals

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions