Created
June 12, 2024 19:52
-
-
Save piclez/fa2518a82bd1f26a69991eb610a5fd3f to your computer and use it in GitHub Desktop.
Lambda Sentry Error
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Sentry = require("@sentry/node"); | |
const { nodeProfilingIntegration } = require("@sentry/profiling-node"); | |
Sentry.init({ | |
dsn: "", | |
integrations: [ | |
nodeProfilingIntegration(), | |
], | |
tracesSampleRate: 1.0, | |
profilesSampleRate: 1.0, | |
}); | |
// exports.handler = async (event) => { | |
// // console.log('hello world'); | |
// const response = { | |
// statusCode: 200, | |
// body: JSON.stringify('Hello from Lambda!') | |
// }; | |
// return response; | |
// }; | |
exports.handler = Sentry.wrapHandler(async (event, context) => { | |
let error = event?.error | |
if (error) { | |
Sentry.captureException(JSON.stringify(error)); | |
} | |
return { | |
error: error | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment