Check-ins
The Honeybadger JavaScript client comes with a helper method checkIn(), that
allows to ping Honeybadger from inside the code. You can read more about
check-ins here.
Usage is pretty simple:
await Honeybadger.checkIn("Slug_or_ID");Configuration
Section titled “Configuration”Honeybadger’s JavaScript packages allow configuring
Check-Ins via a configuration file.
Simply add a honeybadger.config.js or honeybadger.config.ts in your
project’s root folder.
Here’s a sample configuration file:
module.exports = { apiKey: process.env.HONEYBADGER_API_KEY, personalAuthToken: process.env.HONEYBADGER_PERSONAL_AUTH_TOKEN, checkins: [ { scheduleType: "simple", name: "Hourly clean up", slug: "hourly-clean-up", gracePeriod: "5 minutes", reportPeriod: "1 hour", }, { scheduleType: "cron", name: "Hourly check", slug: "hourly-check", cronSchedule: "30 * * * *", cronTimezone: "UTC", }, ],};Prerequisites
Section titled “Prerequisites”Check-in options
Section titled “Check-in options”| Field name | Required |
|---|---|
name | No. |
slug | Yes. This is the identifier used to synchronize check-ins. |
scheduleType | Yes. |
reportPeriod | Only when scheduleType: 'simple'. |
cronSchedule | Only when scheduleType: 'cron'. |
cronTimezone | Only when scheduleType: 'cron'. |
gracePeriod | No. |
You can find more details in the Check-Ins API page.
Synchronization
Section titled “Synchronization”Once you have configured your check-ins, they need to be synchronized with Honeybadger. Usually you would do this as part of your deployment pipeline.
Simply add the following command to your deployment pipeline:
npx honeybadger-checkins-syncThe output of the command will print out created, updated or removed check-ins:
$ npx honeybadger-checkins-syncCheckins were synchronized with Honeybadger.┌─────────┬──────────┬─────────────────────────────────────────┬───────────────┬───────────────┬──────────────┬───────────────────┐│ (index) │ Id │ Name │ Schedule Type │ Report Period │ Grace Period │ Status │├─────────┼──────────┼─────────────────────────────────────────┼───────────────┼───────────────┼──────────────┼───────────────────┤│ 0 │ 'yaI6Pr' │ 'Weekly Exports' │ 'simple' │ '1 week' │ '10 minutes' │ '✅ Synchronized' ││ 1 │ '83Id8v' │ 'Hourly Notifications' │ 'simple' │ '1 hour' │ '5 minutes' │ '✅ Synchronized' ││ 3 │ 'l2Ie8Q' │ 'Hourly SMS Notifications (deprecated)' │ 'simple' │ '1 hour' │ '5 minutes' │ '❌ Removed' │└─────────┴──────────┴─────────────────────────────────────────┴───────────────┴───────────────┴──────────────┴───────────────────┘Validation
Section titled “Validation”The synchronization process will validate the check-ins before sending them to Honeybadger. If any of the check-ins are invalid, the synchronization will fail and most probably the deployment pipeline will fail. If you want to avoid this behavior, you can ignore the result of the command:
npx honeybadger-checkins-sync || trueTroubleshooting
Section titled “Troubleshooting”If you are receiving invalid API key errors, make sure you have set both
apiKey and personalAuthToken in your configuration file. If you are still
receiving errors, it is possible that you have reached your check-in limit or
you are trying to create a check-in that is not supported by your plan.