Node.js中AWS Lambda的Sentry不会发送异常

aGO*_*aGO 2 node.js sentry aws-lambda

我正在尝试在AWS Lambda(nodejs 8.10)上配置哨兵,但没有将异常发送到Sentry。我感觉这是时间问题:在将数据发送到哨兵之前,lambda已终止。

哪种方法可以在AWS Lambda上集成哨兵?

谢谢!

Haz*_*azA 6

您必须使用该函数flush来确保将发送当前排队的所有事件:

Sentry.captureException(new Error('test'));
await Sentry.flush();
Run Code Online (Sandbox Code Playgroud)

http://getsentry.github.io/sentry-javascript/modules/node.html#flush