ComposioHQ/composio · error · ComposioBlockedInternalUrlError

URL file uploads are not supported in edge runtimes because

Error message

URL file uploads are not supported in edge runtimes because the destination cannot be safely validated

What it means

The edge-runtime (workerd/Cloudflare Workers) build of ssrfSafeFetch intentionally fails closed: edge runtimes expose no DNS resolution API, so the SDK cannot prove a hostname is publicly routable before connecting. All URL-based file uploads are therefore unsupported there.

Source

Thrown at ts/packages/core/src/utils/ssrfGuard.workerd.ts:9

import { ComposioBlockedInternalUrlError } from '../errors/SsrfErrors';

/**
 * Edge runtimes do not expose the DNS resolution APIs needed to prove that a
 * hostname is publicly routable before connecting. Fail closed instead of
 * falling back to an unguarded fetch.
 */
export const ssrfSafeFetch = async (rawUrl: string): Promise<Response> => {
  throw new ComposioBlockedInternalUrlError(
    'URL file uploads are not supported in edge runtimes because the destination cannot be safely validated',
    {
      url: rawUrl,
      possibleFixes: [
        'Fetch the public URL yourself and pass a File or ArrayBuffer instead',
        'Run the URL upload in a Node.js or Bun runtime',
      ],
    }
  );
};

/**
 * Unguarded `fetch`, for the call sites that must keep working here.
 *
 * Failing closed is the right default for a URL the caller chose to upload, but
 * applying it to Tool Router session file transfers would take a working
 * feature away from Workers instead of closing a hole reachable there. The
 * guard exists to stop a URL from reaching private address space the SDK's host

View on GitHub (pinned to 64b1b85502)

Solutions

  1. Fetch the URL yourself in the edge runtime and pass the File/ArrayBuffer to the upload API instead of the URL
  2. Move the URL-upload flow to a Node.js or Bun runtime
  3. Guard the code path by environment so edge deployments skip URL uploads

Example fix

// before (in a Cloudflare Worker)
await upload.uploadFileAtUrl(url);

// after
const res = await fetch(url);
const file = await res.blob();
await upload.uploadFile(file);
Defensive patterns

Strategy: fallback

Validate before calling

// detect edge runtimes and switch strategy up front
const isEdge = typeof navigator !== 'undefined' && navigator.userAgent?.includes('Cloudflare-Workers');
const input = isEdge ? await (await fetch(url)).blob() : url;

Try / catch

try {
  await upload.uploadFileAtUrl(url);
} catch (e) {
  if (e instanceof ComposioBlockedInternalUrlError && /edge runtimes/.test(e.message)) {
    const file = await (await fetch(url)).blob();
    return upload.uploadFile(file);
  }
}

Prevention

When it happens

Trigger: Calling a URL-upload API that routes through ssrfSafeFetch inside a Cloudflare Worker / Vercel Edge / other workerd runtime — the function throws unconditionally on every call.

Common situations: Deploying code that worked in Node.js to an edge runtime without changing the upload strategy; edge functions that accept user-supplied file URLs.

Related errors


AI-assisted analysis of ComposioHQ/composio@64b1b85502 (2026-08-28). Data as JSON: /api/errors/6c927c4f323f058c. Report an issue: GitHub.