How to use Sentry in mongodb scheduled trigger

Hello,

I am using Mongodb triggers for running some periodic jobs. In order to collect the errors I want to send them to Sentry by using its SDK on Nodejs:

exports = async function() {
const Sentry = require('@sentry/node');
const SentryTracing = require("@sentry/tracing")
  console.log(Sentry.init)
  Sentry.init(); // or using Sentry.init({ dsn: "something" }) does not make any difference.
}

And I get am getting this error with no stack trace:

> error: 
{"message":"Value is not an object: undefined","name":"TypeError"}

Any help or clue is appreciated.

Hi @Poorshad_Shaddel and welcome in the MongoDB Community :muscle: !

I think you are looking for this doc.

I never touched that part so I can’t really help much but there is some stuff to test I guess.

Cheers,
Maxime.

1 Like

Thanks @MaBeuLux88 !

I will give it a try.

1 Like