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

node-cron and node-schedule fire checkin only on app start #11766

Closed
3 tasks done
s1gr1d opened this issue Apr 24, 2024 · 0 comments · Fixed by #11811
Closed
3 tasks done

node-cron and node-schedule fire checkin only on app start #11766

s1gr1d opened this issue Apr 24, 2024 · 0 comments · Fixed by #11811

Comments

@s1gr1d
Copy link
Member

s1gr1d commented Apr 24, 2024

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/node

SDK Version

7.112.1

Framework Version

express 4.19.2

Link to Sentry event

No response

SDK Setup

Sentry.init({
  dsn: env.DSN,
  debug: true,
  tracesSampleRate: 1,
  profilesSampleRate: 1,
  integrations: [new Sentry.Integrations.Express({ app })],
});

Steps to Reproduce

  1. Created an example app with cron, node-cron and node-schedule
  2. look at the log output

Expected Result

When a job from cron is executed, the Sentry logs are correct. But node-cron and node-schedule are only logged on app start. Those should also log like cron.

Actual Result

This is the log. node-schedule and node-cron produce no Sentry logs anymore.

Sentry Logger [info]: Sending checkin: node-cron_slug in_progress
Sentry Logger [info]: Sending checkin: node-cron_slug ok
Sentry Logger [info]: Sending checkin: node-schedule_slug in_progress
Sentry Logger [info]: Sending checkin: node-schedule_slug ok
Example app listening on port 3030                           <-- app starts here, but node-cron and node-schedule are already sending checkins
Sentry Logger [info]: Sending checkin: cron_slug in_progress
cron: Job is running every few seconds                       <-- cron job runs and logs correct info about checkin
Sentry Logger [info]: Sending checkin: cron_slug ok
node-cron: Job is running every few seconds                  <-- node-cron job runs, but no logs
node-schedule: Job is running every few seconds              <-- node-schedule job runs, but no logs
mydea pushed a commit that referenced this issue May 7, 2024
Closes #11766 

These tests are also in TypeScript so they check the types too.

I found that two out of three cron libraries were actually swallowing
exceptions so that they were not captured by Sentry. I added calls to
`captureException` to rectify that.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants