Backend: Error Monitoring
Backend: Logging
Go
JS
Python
Ruby
Java
Rust
Hosting Providers
Backend: Tracing
Native OpenTelemetry
Fullstack Frameworks
Overview
Self Host & Local Dev
Menu
Hono Error Monitoring
Learn how to set up highlight.io in your Hono application.
1
Add `tracingOrigins` to your client Highlight snippet.
This backend SDK requires one of the Highlight frontend SDKs to be installed, so please make sure you've followed the fullstack mapping guide first.
H.init("<YOUR_PROJECT_ID>", {
tracingOrigins: ['localhost', 'example.myapp.com/backend'],
networkRecording: {
enabled: true,
recordHeadersAndBody: true,
},
});
2
Install the relevant Highlight SDK(s).
Install @highlight-run/hono with your package manager.
npm install --save @highlight-run/hono
3
Add the Hono Highlight middleware
Use the Hono SDK in your response handler. The middleware automatically traces all requests, reports exceptions, and captures console logs to Highlight. It integrates seamlessly with Hono's middleware system for minimal configuration.
import { Hono } from 'hono'
import { highlightMiddleware } from '@highlight-run/hono'
const app = new Hono()
// Initialize the Highlight middleware
app.use(highlightMiddleware({
projectID: '<YOUR_PROJECT_ID>'
}))
// Your routes
app.get('/', (c) => c.text('Hello Hono!'))
// Errors will be automatically caught and reported
app.get('/error', (c) => {
throw new Error('Example error!')
return c.text('This will not be reached')
})
export default app
4
Verify that your SDK is reporting errors.
You'll want to throw an exception in one of your hono handlers. Access the API handler and make sure the error shows up in Highlight.
const app = new Hono()
app.use(highlightMiddleware({ projectID: '<YOUR_PROJECT_ID>' }))
app.get('/error', (c) => {
throw new Error('example error!')
return c.text('Error route')
})