Browser
Server
Native OpenTelemetry
Fullstack Frameworks
Overview
Self Host & Local Dev
Menu
Firebase Quick Start
Learn how to set up highlight.io in Firebase Cloud Functions.
1
Configure client-side Highlight. (optional)
If you're using Highlight on the frontend for your application, make sure you've initialized it correctly and followed the fullstack mapping guide.
2
Install the relevant Highlight SDK(s).
Install @highlight-run/node with your package manager.
npm install --save @highlight-run/node
3
Initialize the Highlight JS SDK.
Initialize the Highlight JS SDK with your project ID.
import { H } from '@highlight-run/node'
H.init({
projectID: '<YOUR_PROJECT_ID>',
serviceName: '<YOUR_SERVICE_NAME>',
environment: 'production',
})
4
Add the Firebase Highlight integration.
Use the Node Highlight SDK in your response handler.
const highlightNode = require('@highlight-run/node')
// Callable function wrapper
exports.exampleCallable = functions.https.onCall(
highlightNode.Handlers.firebaseCallableFunctionHandler(
(data, context) => {
// ... your handler code here
return { result: 'useful result!' }
},
{
projectID: '<YOUR_PROJECT_ID>',
serviceName: 'my-firebase-app',
serviceVersion: 'git-sha',
environment: 'production'
},
),
)
// Http function wrapper
exports.exampleHttp = functions.https.onRequest(
highlightNode.Handlers.firebaseHttpFunctionHandler(
(req, res) => {
// ... your handler code here
res.json({ result: 'useful result!' })
},
{ projectID: '<YOUR_PROJECT_ID>' },
),
)
5
Verify that your SDK is reporting errors.
You'll want to throw an exception in one of your Firebase handlers. Access the API handler and make sure the error shows up in Highlight.
exports.exampleCallable = functions.https.onCall(
highlightNode.Handlers.firebaseCallableFunctionHandler(
(data, context) => {
throw new Error('example error!')
return { result: 'useful result!' }
},
{
projectID: '<YOUR_PROJECT_ID>',
serviceName: 'my-firebase-app',
serviceVersion: 'git-sha',
environment: 'production'
},
),
)
6
Verify your backend logs are being recorded.
Visit the highlight logs portal and check that backend logs are coming in.
7
Verify your backend traces are being recorded.
Visit the highlight traces portal and check that backend traces are coming in.