Guides

How do I add error tracking to a Lovable, Replit or Bolt app?

Report errors from your app's server code, then connect the tracker to the builder's agent. On Lovable, and on Bolt with Supabase, that means one shared file in your Edge Functions. On Replit, it means the Runheed Node.js or Python SDK. Errors in the browser are not captured, because Runheed has no browser SDK yet.

What each builder needs

BuilderWhere server code runsReport errors withWhere the key goesFull steps
LovableBackend functions, on Lovable Cloud (built on Supabase's foundation) or your own Supabase projectA shared file wrapping each functionLovable Cloud: More > Secrets. Own project: Supabase secrets. Name it RUNHEED_KEYLovable
ReplitYour Node.js or Python serverThe SDKA Replit secret named RUNHEED_DSNReplit
Bolt with SupabaseSupabase Edge FunctionsA shared file wrapping each functionSupabase secret RUNHEED_KEYBolt
Bolt with Bolt DatabaseServer functionsA POST to the ingest endpoint (not tested by us)Your project's secrets, under Backend and credentialsDocs

The steps

  1. Create a project in Runheed and copy its DSN. Edge Functions use the pk_... part of it as the key.
  2. Store it as a secret in the place the table shows. Never paste it into a prompt that writes it into the code.
  3. Connect the server URL https://runheed.com/api/mcp to the builder as an MCP connector and sign in. Lovable: Connectors > Add custom > MCP server. Replit: replit.com/integrations, under MCP Servers. Bolt: plus icon in the chatbox > Connectors > Manage connectors > Custom MCP server.
  4. Paste the prompt from your builder's setup page into its chat. It writes the reporting code, throws one test error, confirms it through the connector and removes the test code.
  5. Ask in the chat: "Using the Runheed connector, list my newest unresolved errors and fix the top one."

On Replit, the code looks like this

terminalbash
npm install https://runheed.com/dl/runheed-0.1.1.tgz
# or, for Python
pip install https://runheed.com/dl/runheed-0.1.1-py3-none-any.whl
Node.jstypescript
import runheed from 'runheed';

runheed.init({
  dsn: process.env.RUNHEED_DSN!,
  environment: 'production',
  release: process.env.GIT_SHA, // optional: lets the agent match errors to a deploy
});
Pythonpython
import os, runheed

runheed.init(dsn=os.environ["RUNHEED_DSN"], environment="production")

For Lovable and Bolt on Supabase, the shared file needs no package because it reports with fetch. It is explained line by line on the Supabase Edge Functions page.

What gets captured

FailureCaptured?
A wrapped Edge Function throwsYes, with the request. The shared file on the Supabase page also sends the stack trace
A Node.js or Python server has an uncaught exceptionYes, automatically once the SDK is initialized
Your code catches an error and returns a responseOnly if you report it in the catch block
A database policy or trigger failsOnly when a function receives the failure and reports it
A React component crashes in the browser, or a button handler throwsNo. There is no browser SDK yet

If your app has no server code at all, Runheed has nothing to record yet, and it is not the right tool today.

Questions

Will the connector ship with my published app?
On Lovable, no: its docs say chat connectors are personal to you and are never part of your published app. The reporting code does ship, and it only sends errors.
Can the builder's agent fix the errors itself?
Once connected, it can list and read errors through Runheed's tools and edit your project as usual. Check the change in your builder before you publish it. Then ask it to resolve the error; if the same error comes back, it reopens on its own.
Do I need to know how to code?
Not for the setup. The builder's agent writes the code from the prompt on the setup page. You create the project, store the secret and connect the server.
What does it cost?
Plans start at $29/month for 50,000 events a month, 3 projects and 30 days of history. Events over the monthly limit are rejected, never billed.

Related