{"record":{"id":"4bd77d0270de191e","repo":"earendil-works/pi","slug":"creategatewaybindingfetch-cannot-express-method","errorCode":null,"errorMessage":"createGatewayBindingFetch: cannot express ${method} ${url} as a universal gateway request (${reason}); route it over HTTPS with gateway auth instead","messagePattern":"createGatewayBindingFetch: cannot express (.+?) (.+?) as a universal gateway request \\((.+?)\\); route it over HTTPS with gateway auth instead","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/ai/src/api/cloudflare-gateway-binding.ts","lineNumber":111,"sourceCode":"\t\t\tparsed = new URL(url);\n\t\t} catch {\n\t\t\tparsed = undefined;\n\t\t}\n\t\t// Out-of-prefix URLs are a configuration bug, not passthrough traffic: silently\n\t\t// forwarding would ship the auth sentinel to whatever host the URL names.\n\t\tif (parsed === undefined || parsed.origin !== base.origin || !parsed.pathname.startsWith(basePath)) {\n\t\t\tthrow new Error(\n\t\t\t\t`createGatewayBindingFetch: ${method} ${url} is outside the configured gateway ` +\n\t\t\t\t\t`prefix (${base.origin}${basePath}); this fetch only serves its gateway-bound client`,\n\t\t\t);\n\t\t}\n\n\t\t// In-prefix requests the universal endpoint cannot express always reject: forwarding\n\t\t// them over HTTPS would send the sentinel to the gateway and fail with a misleading\n\t\t// auth error instead of naming the real problem. Callers that need such endpoints\n\t\t// route them over HTTPS with real gateway auth themselves.\n\t\tconst unexpressible = (reason: string): never => {\n\t\t\tthrow new Error(\n\t\t\t\t`createGatewayBindingFetch: cannot express ${method} ${url} as a universal ` +\n\t\t\t\t\t`gateway request (${reason}); route it over HTTPS with gateway auth instead`,\n\t\t\t);\n\t\t};\n\t\tif (method !== \"POST\") return unexpressible(\"only POST is supported\");\n\n\t\tconst rest = parsed.pathname.slice(basePath.length);\n\t\tconst slash = rest.indexOf(\"/\");\n\t\tif (slash <= 0) {\n\t\t\treturn unexpressible(\"missing provider/endpoint path\");\n\t\t}\n\t\tconst provider = rest.slice(0, slash);\n\t\t// Keep the query string on the endpoint — it's part of what HTTPS would have sent.\n\t\tconst endpoint = rest.slice(slash + 1) + parsed.search;\n\n\t\tconst bodyText = await readBodyText(request, init);\n\t\tlet query: unknown;\n\t\ttry {","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/earendil-works/pi/blob/4af9d21d3b4d664e4a29fcabfec85171077248e3/packages/ai/src/api/cloudflare-gateway-binding.ts#L93-L129","documentation":"Error \"createGatewayBindingFetch: cannot express ${method} ${url} as a universal gateway request (${reason}); route it over HTTPS with gateway auth instead\" thrown in earendil-works/pi.","triggerScenarios":"Thrown at packages/ai/src/api/cloudflare-gateway-binding.ts:111 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Route the request over HTTPS with gateway auth instead of the binding fetch."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4af9d21d3b4d664e4a29fcabfec85171077248e3","analyzedAt":"2026-08-24T13:07:14.692Z","schemaVersion":2},"datasetVersion":"2026-08-24T17:17:21.512Z"}