Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sentry middleware example doesn't work #602

Closed
opsb opened this issue Jun 7, 2024 · 4 comments
Closed

Sentry middleware example doesn't work #602

opsb opened this issue Jun 7, 2024 · 4 comments
Assignees
Labels
Bug Something isn't working

Comments

@opsb
Copy link

opsb commented Jun 7, 2024

Describe the bug
When an error occurs the sentryMiddleware never reports an error. The error should be reported in

  transformOutput({ result, step }) {
    // Capture step output and log errors
    if (step) {
      Sentry.setTags({
        "inngest.step.name": step.displayName,
        "inngest.step.op": step.op,
      });

      if (result.error) {
        Sentry.captureException(result.error);
      }
    }
  },

but step is always undefined.

To Reproduce
Add example middleware as per https://www.inngest.com/docs/reference/middleware/examples#adding-sentry-error-reporting-and-tracing.

Throw an error in a handler.

Expected behavior
Error should be report to Sentry

Screenshots / Stack trace dump
If applicable, add screenshots or paste what is output in your terminal to help explain your problem.

System info

  • inngest-cli version: [e.g. 1.0.2]
  • OS: [e.g. macOS]
  • Version [e.g. 22]

Additional context
Workaround is to report the error without the step metadata

  transformOutput({ result, step }) {
    // Capture step output and log errors
    if (step) {
      Sentry.setTags({
        "inngest.step.name": step.displayName,
        "inngest.step.op": step.op,
      });
    }

    if (result.error) {
      Sentry.captureException(result.error);
    }
  },
@opsb opsb added the Bug Something isn't working label Jun 7, 2024
Copy link

linear bot commented Jun 7, 2024

@jpwilliams jpwilliams transferred this issue from inngest/inngest Jun 7, 2024
Copy link

linear bot commented Jun 7, 2024

@jpwilliams
Copy link
Member

Hi, @opsb! 👋

Ah - good find. What version of Sentry are you using?

We have some discussion in #471 which results in the release of a new @inngest/middleware-sentry package in #598.

I'd love it if you could test out the new package and see if this also solves your issue, though we're targeting @sentry/node>=8.0.0 for that.

@jpwilliams
Copy link
Member

Closing this - please address any further issues here in #471 or #598.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants