Express api basic auth middleware make sentry unable to work

I have a nodeJs express router, that is able to send errors with Sentry.captureException only before i add a basic auth middleware using:

let basic = auth.basic({ realm: "api that dispatch requests.." }, (username, password, callback) => { callback(username === vars.username && password === vars.password); }); app.use(auth.connect(basic));

If i define my POST route after this code, i get:
Sentry Logger [Error]: 'beforeSend' threw an error, will not send event.

I can’t remove my BasicAuth, and find extremely important to be able to report exceptions in my authenticated routes…

Thanks for any help
Victor

The lib i use for auth is http-auth