0.0.8 • Published 4 years ago
sentry-handler-node v0.0.8
sentry-handler-node
sentry-handler-node is a lightweight wrapper for your Node applications that will automatically send any unhandled errors to Sentry.
Setup
Setting up sentry-handler-node is super easy.
Install sentry-handler-node.
npm i sentry-handler-node
Wrap the entry point of your Node application.
const { withSentry } = require('sentry-handler-node'); // everything in this object gets sent to sentry.init() const config = { dsn: 'https://your-sentry-dsn-url@sentry.io/xxxxxxx' }; module.exports = withSentry(myAsyncFunction, config);
(Optional) Set NODE_ENV to 'development' when not in production.
Setting NODE_ENV to 'development' will just console.error your errors, it won't send anything to Sentry. There are a bunch of ways to set NODE_ENV, it just depends on how your project is setup.
Setting NODE_ENV
lambda-local: add this argument to your lambda-local command:
-E '{\"NODE_ENV\": \"development\"}'