NPM Package

Learn how to install the Sentry AWS NPM package to use Sentry in your Lambda functions

Based on whether your Lambda function runs in CommonJS or ESM, you need to follow the instructions for the corresponding module system.

If you're using TypeScript, your lambda function is likely transpiled to CommonJS before running it. In this case, follow the CommonJS instructions. Note that TypeScript can also be configured to output ESM, in which case you should follow the ESM instructions.

If you are using require() in your function, follow the CommonJS instructions.

If you're using import syntax in your function and you're not transpiling the code to CommonJS, follow the ESM instructions.

Was this helpful?
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").