{"record":{"id":"a33e8d7dee9c1454","repo":"withastro/astro","slug":"clientaddressnotavailable","errorCode":"ClientAddressNotAvailable","errorMessage":"`Astro.clientAddress` is not available in the `${adapterName}` adapter. File an issue with the adapter to add support.","messagePattern":"`Astro\\.clientAddress` is not available in the `(.+?)` adapter\\. File an issue with the adapter to add support\\.","errorType":"exception","errorClass":"AstroError","httpStatus":null,"severity":"error","filePath":"packages/astro/src/core/fetch/fetch-state.ts","lineNumber":603,"sourceCode":"\t}\n\n\tgetClientAddress(): string {\n\t\tconst { pipeline, clientAddress } = this;\n\t\tconst routeData = this.routeData!;\n\n\t\tif (routeData.prerender) {\n\t\t\tthrow new AstroError({\n\t\t\t\t...AstroErrorData.PrerenderClientAddressNotAvailable,\n\t\t\t\tmessage: AstroErrorData.PrerenderClientAddressNotAvailable.message(routeData.component),\n\t\t\t});\n\t\t}\n\n\t\tif (clientAddress) {\n\t\t\treturn clientAddress;\n\t\t}\n\n\t\tif (pipeline.adapterName) {\n\t\t\tthrow new AstroError({\n\t\t\t\t...AstroErrorData.ClientAddressNotAvailable,\n\t\t\t\tmessage: AstroErrorData.ClientAddressNotAvailable.message(pipeline.adapterName),\n\t\t\t});\n\t\t}\n\n\t\tthrow new AstroError(AstroErrorData.StaticClientAddressNotAvailable);\n\t}\n\n\tgetCookies(): AstroCookies {\n\t\treturn this.cookies;\n\t}\n\n\tgetCsp(): APIContext['csp'] {\n\t\tconst state = this;\n\t\tconst { pipeline } = this;\n\t\tif (!pipeline.manifest.csp) {\n\t\t\tif (pipeline.runtimeMode === 'production') {\n\t\t\t\tpipeline.logger.warn(","sourceCodeStart":585,"sourceCodeEnd":621,"githubUrl":"https://github.com/withastro/astro/blob/d081033d5fe8e8a68c4bbbad4af9d2deb9c74bca/packages/astro/src/core/fetch/fetch-state.ts#L585-L621","documentation":"Thrown when Astro.clientAddress is read on a server-rendered route but the active adapter does not provide a clientAddress value. The adapter is responsible for populating pipeline.clientAddress; if it has an adapterName but no address, the IP cannot be trusted and Astro refuses to return a fabricated one.","triggerScenarios":"Deploying to an adapter that has not implemented client address forwarding (pipeline.adapterName is set but clientAddress is undefined) and then reading Astro.clientAddress. Common with bare or older community adapters, or when sitting behind a proxy the adapter does not read.","commonSituations":"Using the Node adapter in standalone mode behind a reverse proxy without configuring trusted proxy headers; using an adapter version that predates clientAddress support; switching adapters from one that supports clientAddress (e.g. a platform adapter) to one that does not.","solutions":["Upgrade your adapter to a version that implements clientAddress forwarding.","Use an adapter that documents clientAddress support, or file an issue with the adapter maintainer as the message suggests.","Read the forwarded IP from request headers (e.g. Astro.request.headers.get('x-forwarded-for')) when you control the proxy, after validating the header."],"exampleFix":"// before\nconst ip = Astro.clientAddress; // throws on unsupported adapter\n\n// after\nconst ip =\n  Astro.request.headers.get('x-forwarded-for')?.split(',')[0]?.trim() ?? 'unknown';","handlingStrategy":"type-guard","validationCode":"// Check adapter support before reading clientAddress.\nconst adapterName = (Astro as any).pipeline?.adapterName;\nconst supportsClientAddress = ['@astrojs/node', '@astrojs/vercel', '@astrojs/cloudflare']\n  .some((a) => adapterName?.startsWith(a));\nconst ip = supportsClientAddress ? Astro.clientAddress : undefined;","typeGuard":"function adapterSupportsClientAddress(pipeline: { adapterName?: string }): boolean {\n  return Boolean(pipeline.adapterName); // refine per known adapters\n}","tryCatchPattern":"try {\n  ip = Astro.clientAddress;\n} catch (e) {\n  if (e instanceof Error && /not available/i.test(e.message)) {\n    ip = Astro.request.headers.get('x-forwarded-for') ?? undefined;\n  } else throw e;\n}","preventionTips":["Confirm your adapter documents clientAddress support before using it.","Keep a header-based fallback for proxies.","Pin adapter versions that support clientAddress."],"tags":["clientaddress","adapter","ssr","deployment"],"backgroundTag":null,"analyzedSha":"d081033d5fe8e8a68c4bbbad4af9d2deb9c74bca","analyzedAt":"2026-08-12T13:37:29.035Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}