Skip to content

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");

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:

honeybadger.config.js
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",
},
],
};
Field nameRequired
nameNo.
slugYes. This is the identifier used to synchronize check-ins.
scheduleTypeYes.
reportPeriodOnly when scheduleType: 'simple'.
cronScheduleOnly when scheduleType: 'cron'.
cronTimezoneOnly when scheduleType: 'cron'.
gracePeriodNo.

You can find more details in the Check-Ins API page.

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:

Terminal window
npx honeybadger-checkins-sync

The output of the command will print out created, updated or removed check-ins:

Terminal window
$ npx honeybadger-checkins-sync
Checkins 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'
└─────────┴──────────┴─────────────────────────────────────────┴───────────────┴───────────────┴──────────────┴───────────────────┘

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:

Terminal window
npx honeybadger-checkins-sync || true

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.