← All platforms

Azure Functions (JavaScript) error tracking

Your function runs on Azure. Your error reports don’t have to. Use the Sentry Node.js SDK to send them to Telebugs on your server.

~/hoofnotes  npm install @sentry/node
~/hoofnotes  nvim save-note/index.js
const Sentry = require("@sentry/node");
const { saveNote } = require("../hoofnotes/notes");
Sentry.init({
// Copy the complete Telebugs DSN, key and path included.
dsn: "YOUR_TELEBUGS_DSN",
});
module.exports = async function (context, req) {
try {
context.res = await saveNote(req);
} catch (error) {
Sentry.captureException(error);
await Sentry.flush(2000);
throw error;
}
};
~/hoofnotes  func start

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

Hang on, I already use Sentry

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

What about errors caught inside the function?

You can report them explicitly through the Node.js SDK. The function must allow time for delivery before it ends; Telebugs then keeps the error and its backtrace.

Does self-hosting mean leaving Azure?

No. Keep the function on Azure and make your Telebugs endpoint reachable from it. You choose where the error reports are stored.