-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed as not planned
Closed as not planned
Copy link
Description
- Review the documentation: https://docs.sentry.io/
- Search for existing issues: https://github.com/getsentry/sentry-javascript/issues
- Use the latest release: https://github.com/getsentry/sentry-javascript/releases
- Provide a link to the affected event from your Sentry account
Package + Version
-
@sentry/browser
-
@sentry/node
-
raven-js
-
raven-node
(raven for node) - other:
Version:
6.0.2
Description
I'm following the example provided to integrate it with an Azure Function. Here's how my code looks like simplified:
const Sentry = require("@sentry/node");
Sentry.init({
dsn: process.env["SENTRY_DSN"],
environment: process.env["ENVIRONMENT"] || "PROD",
sendDefaultPii: true,
});
module.exports = async function (context, myQueueItem) {
return new Promise((resolve, reject) => {
Sentry.withScope(async (scope) => {
try {
// setting some context and tags
scope.setContext("Queue Item", myQueueItem);
scope.setTags({...});
// do stuff
}
catch (e) {
Sentry.captureException(e);
await Sentry.flush(2000);
reject(e);
}
finally {
// some cleanup code...
resolve();
}
}
When an error is captured and sent to Sentry I can see it has breadcrumbs from previous executions instead of just the single one that throw.
Also, the context and tags are nowhere to be seen on the event.
Am I doing something wrong? If I do, could you please provide a full Azure Function example? This sample doesn't demonstrate how to properly scope context/tags to a single function invocation.
Metadata
Metadata
Assignees
Labels
No labels