Logging errors in your AWS lambda express server with Sentry

Mauro
1 min readJul 3, 2020

For the last six months I’ve been developing a platform completely serverless using AWS services. One tool that I’m using for the API is aws-serverless-express, which allows you to use express.js together with AWS lambda.

One thing that I couldn’t find was how to correctly use Sentry, the monitoring platform, with this kind of setup. After doing some research and diving into AWS’s code, I arrived to this code:

The important part that you may struggle with if you have been working with AWS serverless express is that you need to specify ‘PROMISE’ as the type of return you want in order to be able to handle errors with Sentry.

--

--