{"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":647,"sourceCode":"\t}\n\n\tgetClientAddress(): string {\n\t\tconst { 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 (this.manifest.adapterName) {\n\t\t\tthrow new AstroError({\n\t\t\t\t...AstroErrorData.ClientAddressNotAvailable,\n\t\t\t\tmessage: AstroErrorData.ClientAddressNotAvailable.message(this.manifest.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\tif (!this.manifest.csp) {\n\t\t\tif (getEnvironment(this.manifest).runtimeMode === 'production') {\n\t\t\t\tthis.logger.warn(\n\t\t\t\t\t'csp',","sourceCodeStart":629,"sourceCodeEnd":665,"githubUrl":"https://github.com/withastro/astro/blob/e294953aa8aadd98d5be92e60a03037b05dbdfd4/packages/astro/src/core/fetch/fetch-state.ts#L629-L665","documentation":"When no clientAddress was attached to the request state and the manifest names an adapter, getClientAddress() throws AstroErrorData.ClientAddressNotAvailable. The configured adapter did not hand Astro a trusted client IP for this request — either the adapter never implements it, or it is running in a mode (often edge/split modes) where the socket address is not visible to the app.","triggerScenarios":"Astro.clientAddress on a server-rendered route while using an adapter that does not provide the address in the current deployment mode; upgrading an adapter to a version that changed which modes expose the IP; running the adapter's edge variant.","commonSituations":"Switching @astrojs/vercel or @astrojs/netlify to edge/split mode where no reverse-proxy IP is forwarded; using an older or minimal adapter; deploying behind a platform whose adapter build has no clientAddress support yet.","solutions":["Update the adapter to its latest version — support is often added in patches","Switch the adapter/deployment to a mode that exposes the remote address (for example function/standalone instead of edge)","Read the platform's forwarded headers yourself: Astro.request.headers.get('x-forwarded-for') or x-real-ip","If nothing works, file an issue with the adapter as the error message suggests"],"exampleFix":"// before\nconst ip = Astro.clientAddress;\n\n// after\nconst ip =\n  Astro.request.headers.get('x-forwarded-for')?.split(',')[0]?.trim() ??\n  Astro.request.headers.get('x-real-ip');","handlingStrategy":"fallback","validationCode":"function getClientIp(request: Request): string | null {\n  return (\n    request.headers.get('x-forwarded-for')?.split(',')[0]?.trim() ??\n    request.headers.get('x-real-ip')\n  );\n}\n// use getClientIp(Astro.request) when the adapter does not provide Astro.clientAddress","typeGuard":null,"tryCatchPattern":"let ip: string;\ntry {\n  ip = Astro.clientAddress;\n} catch {\n  ip = getClientIp(Astro.request) ?? 'unknown';\n}","preventionTips":["Check the adapter's documentation for clientAddress support before using it","Keep the adapter updated and verify IP availability after switching deployment modes","Wrap clientAddress access in one helper so a mode change only needs a single fix"],"tags":["client-address","adapter","deployment-mode","headers"],"backgroundTag":"client-address-unavailable","analyzedSha":"e294953aa8aadd98d5be92e60a03037b05dbdfd4","analyzedAt":"2026-08-18T18:48:03.901Z","contentChangedAt":"2026-08-18T18:48:03.901Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}