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 handler issue #473

Open
osameyy opened this issue Apr 25, 2024 · 1 comment
Open

sentry middleware handler issue #473

osameyy opened this issue Apr 25, 2024 · 1 comment

Comments

@osameyy
Copy link

osameyy commented Apr 25, 2024

TypeError: Cannot read properties of undefined (reading 'setContext')

app.use('*', async (c: Context, next) => {
  sentry({
    dsn: 'example.com',
    tracesSampleRate: parseFloat(
      (c.env.SENTRY_TRACES_SAMPLE_RATE as string) || '0',
    ),
    environment:
      c.env.SENTRY_ENV === 'master' ? 'production' : c.env.SENTRY_ENV,
    release:
      `${packageJson.name}@${packageJson.version}` +
      (c.env.SENTRY_ENV === 'master' ? '' : '-' + c.env.SENTRY_ENV),
  });
  await next();
`});`

sentry does not get initialised, but if I do this directly, it works:

app.use('*', sentry({
    dsn: 'example.com',
    });

But I need it in the handler so I can add variables from env context

@osameyy
Copy link
Author

osameyy commented Apr 28, 2024

@sam-lippert can you check this out?
@yusukebe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant