← All platforms

Google Cloud Functions (JavaScript) error tracking

Google runs your function. You keep the error reports. The Sentry Google Cloud SDK sends JavaScript exceptions to Telebugs on your server.

~/hoofnotes  npm install @sentry/google-cloud-serverless
~/hoofnotes  nvim index.js
const Sentry = require("@sentry/google-cloud-serverless");
const { saveNote } = require("./hoofnotes/notes");
Sentry.init({
// Copy the complete Telebugs DSN, key and path included.
dsn: "YOUR_TELEBUGS_DSN",
});
exports.saveNote = Sentry.wrapHttpFunction(saveNote);
~/hoofnotes  npm run start

Space pauses or resumes. R replays. Escape shows the complete setup.

Hang on, I already use Sentry

Keep @sentry/google-cloud-serverless and change its destination to your Telebugs DSN. Your error reports stay on your server. You don’t need a Sentry account.

Only HTTP functions?

The SDK has wrappers for HTTP functions, background events, and CloudEvents. Choose the one matching your handler; the error reports can all go to Telebugs.

Do the reports stay in Google Cloud?

Only if that is where you choose to host Telebugs. The SDK sends reports to your DSN, so your app and tracker don’t have to share a hosting provider.