Using sentry AWSLambda module with layer0

We would like to capture serverless errors to sentry. Sentry has a solution for AWS: https://blog.sentry.io/2020/10/01/debug-errors-in-lambda-functions
Where should I put this code from an example? My guess is prod.js entry point, however I can’t really get it to work.

exports.handler = Sentry.AWSLambda.wrapHandler(async (event, context) => {
  // Your handler code
});

We don’t have formal support for this yet. You would need a custom connector. But it’s at the top of our backlog.

@mark.brocato we are using custom connector

In that case you should just be able to wrap the body of the function in the prod entrypoint with Sentry’s error handler.

@mark.brocato is prod.js is a real entrypoint for lambda? When I expose handler instead of default export, my app stops working. My guess is that I don’t have real control over lambda handler, is this correct?

"error": "r is not a function",
"stack": "TypeError: r is not a function\n    at /var/task/handler.js:2:86205\n    at /var/task/handler.js:2:84887\n    at Object.next (/var/task/handler.js:2:84992)\n    at /var/task/handler.js:2:83904\n    at new Promise (<anonymous>)\n    at n (/var/task/handler.js:2:83649)\n    at v (/var/task/handler.js:2:85977)\n    at Runtime.<anonymous> (/var/task/handler.js:2:85701)\n    at /var/task/handler.js:2:84887\n    at Object.next (/var/task/handler.js:2:84992)"

prod.js isn’t the lambda handler itself, but it’s near the top of the stack, so you would be able to catch any errors thrown by your application and report them to Sentry.