Asset pipelines

Pull remote assets into a transform pipeline without a shell

Asset pipelines fetch URLs chosen by users and partners: an avatar link, a storefront image, a scanned receipt. Each one is an outbound request you did not write and will be asked about later.

Where it goes wrong

Image fetchers are usually the least-reviewed outbound code in a codebase — no timeout, no size ceiling, quietly following whatever redirect a CDN returns, and no record of the source bytes once resizing starts.

What Backfire handles

  • Binary responses arrive as base64 with a byte count, ready for a decoder or an object store.
  • Blocked hosts and ambiguous DNS fail closed instead of handing back a half-fetched file.
  • Size ceilings mean an accidental video or a decompression bomb is refused, not buffered.
  • The source URL of every asset sits in the log next to the bytes it produced.

The request

example
const envelope = await (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: asset.remote_url, method: 'GET', timeout_ms: 15000 }),
})).json();

if (envelope.ok && envelope.body.encoding === 'base64') {
  const bytes = Buffer.from(envelope.body.data, 'base64');
  await thumbnails.write(asset.id, bytes); // bytes.byteLength is reported too
}

All use cases

Questions about this

Keep reading

Try it with 5,000 free trips.

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