Vercel functions

Use Backfire from Vercel functions and route handlers

A Vercel function is an ephemeral process with an open outbound network. Backfire gives those invocations one authenticated egress path, so a URL that arrived in a request body is never handed straight to fetch().

What to expect

  • Works in both the Node.js and Edge runtimes — it is a plain HTTPS POST with a JSON body.
  • Keep BACKFIRE_KEY in your Vercel environment variables; one key per environment, revocable without a redeploy.
  • Timeout ceilings are enforced by the relay, so a slow upstream cannot hold an invocation open.
  • Every call is written to your activity log with the target host, status and duration.

Working example

vercel
// app/api/profile/route.ts  (Node.js or Edge runtime)
export async function GET(request: Request) {
  const upstream = await fetch('https://backfireapi.base44.app/functions/forward', {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${process.env.BACKFIRE_KEY}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      url: 'https://api.example.com/v1/profile',
      method: 'GET',
      headers: { Accept: 'application/json' },
      timeout_ms: 8000,
    }),
  });

  const envelope = await upstream.json();
  if (!envelope.ok) {
    return Response.json({ error: envelope.error.code }, { status: 502 });
  }
  return Response.json(envelope.body.json);
}

Other environments

Questions about this

Keep reading

Try it with 5,000 free trips.

No card, no subscription, and the balance never expires.