{"record":{"id":"7afb3bc3fde1db29","repo":"ComposioHQ/composio","slug":"proxy-does-not-support-passing-a-request-instanc","errorCode":null,"errorMessage":"proxy() does not support passing a Request instance yet. Pass a URL string and init instead.","messagePattern":"proxy\\(\\) does not support passing a Request instance yet\\. Pass a URL string and init instead\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"ts/packages/cli/src/services/run-helpers-runtime.ts","lineNumber":423,"sourceCode":"  });\n  return normalized;\n};\n\nconst normalizeFetchBody = async (body: unknown) => {\n  if (body === undefined || body === null) return undefined;\n  if (typeof body === 'string' || typeof body === 'number' || typeof body === 'boolean')\n    return body;\n  if (typeof Blob !== 'undefined' && body instanceof Blob) return await body.text();\n  if (body instanceof ArrayBuffer) return encodeBase64(new Uint8Array(body));\n  if (ArrayBuffer.isView(body)) {\n    return encodeBase64(new Uint8Array(body.buffer, body.byteOffset, body.byteLength));\n  }\n  return body;\n};\n\nconst normalizeFetchInput = async (input: unknown, init: RequestInit = {}) => {\n  if (typeof Request !== 'undefined' && input instanceof Request) {\n    throw new Error(\n      'proxy() does not support passing a Request instance yet. Pass a URL string and init instead.'\n    );\n  }\n  const endpoint = input instanceof URL ? input.toString() : input;\n  if (typeof endpoint !== 'string' || endpoint.trim().length === 0) {\n    throw new Error('proxy fetch requires a non-empty URL string or URL object.');\n  }\n  const method = typeof init.method === 'string' ? init.method.toUpperCase() : 'GET';\n  if (!['GET', 'POST', 'PUT', 'DELETE', 'PATCH'].includes(method)) {\n    throw new Error('proxy fetch only supports GET, POST, PUT, DELETE, PATCH.');\n  }\n  return {\n    endpoint: endpoint.trim(),\n    method,\n    parameters: normalizeFetchHeaders(init.headers),\n    body: await normalizeFetchBody(init.body),\n  };\n};","sourceCodeStart":405,"sourceCodeEnd":441,"githubUrl":"https://github.com/ComposioHQ/composio/blob/64b1b85502b1beeb2379e6c9e8bf1104504fa637/ts/packages/cli/src/services/run-helpers-runtime.ts#L405-L441","documentation":"proxy()'s fetch passthrough (normalizeFetchInput) explicitly rejects Request instances. Only URL strings, URL objects, and a RequestInit-style init object are supported, because the proxy serializes endpoint/method/headers/body itself.","triggerScenarios":"Calling proxy.fetch(new Request('https://example.com'), ...) or passing a Request built by another wrapper (e.g. a middleware) into the proxied fetch.","commonSituations":"Reusing code written for standard fetch that constructs Request objects; middleware/interceptor libraries that hand Request instances downstream.","solutions":["Pass the URL string (or URL object) plus an init object: proxy.fetch(url, { method, headers, body })","Copy relevant fields off the Request (url, method, headers, body) into a plain init object"],"exampleFix":"// before\nconst req = new Request('https://api.example.com/x', { method: 'POST' });\nawait proxy.fetch(req);\n// after\nawait proxy.fetch('https://api.example.com/x', { method: 'POST' });","handlingStrategy":"fallback","validationCode":"if (typeof Request !== 'undefined' && input instanceof Request) {\n  input = { url: input.url, init: { method: input.method, headers: [...input.headers], body: await input.text() } };\n}","typeGuard":"const isRequestInstance = (v: unknown): v is Request => typeof Request !== 'undefined' && v instanceof Request;","tryCatchPattern":null,"preventionTips":["Always call proxy.fetch(url, init), never with a Request","Refactor shared fetch middleware to pass (url, init) tuples"],"tags":["proxy","fetch","request","unsupported-operation"],"backgroundTag":"unsupported-argument-type","analyzedSha":"64b1b85502b1beeb2379e6c9e8bf1104504fa637","analyzedAt":"2026-08-28T15:39:33.623Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}