{"record":{"id":"9b171bb9a246e02e","repo":"withastro/astro","slug":"context-params-don-t-contain-any-usable-content-in","errorCode":null,"errorMessage":"context.params don't contain any usable content in Astro.","messagePattern":"context\\.params don't contain any usable content in Astro\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/integrations/netlify/src/index.ts","lineNumber":604,"sourceCode":"\t\t\t\t\t? req.headers['x-nf-client-connection-ip']\n\t\t\t\t\t: (req.socket.remoteAddress ?? '127.0.0.1'),\n\t\t\tserver: {\n\t\t\t\tregion: 'local-dev',\n\t\t\t},\n\t\t\trequestId:\n\t\t\t\ttypeof req.headers['x-nf-request-id'] === 'string'\n\t\t\t\t\t? req.headers['x-nf-request-id']\n\t\t\t\t\t: 'mock-netlify-request-id',\n\t\t\tget cookies(): never {\n\t\t\t\tthrow new Error('Please use Astro.cookies instead.');\n\t\t\t},\n\t\t\tjson: (input) => Response.json(input),\n\t\t\tlog: console.info,\n\t\t\tnext: () => {\n\t\t\t\tthrow new Error('`context.next` is not implemented for serverless functions');\n\t\t\t},\n\t\t\tget params(): never {\n\t\t\t\tthrow new Error(\"context.params don't contain any usable content in Astro.\");\n\t\t\t},\n\t\t\trewrite() {\n\t\t\t\tthrow new Error('context.rewrite is not available in Astro.');\n\t\t\t},\n\t\t};\n\n\t\treturn context;\n\t}\n\n\tlet routes: IntegrationResolvedRoute[];\n\n\treturn {\n\t\tname: '@astrojs/netlify',\n\t\thooks: {\n\t\t\t'astro:config:setup': async ({ config, updateConfig, logger, command }) => {\n\t\t\t\trootDir = config.root;\n\t\t\t\tawait cleanFunctions();\n","sourceCodeStart":586,"sourceCodeEnd":622,"githubUrl":"https://github.com/withastro/astro/blob/3578d45d34226d63cff3d261c971c221de6794d2/packages/integrations/netlify/src/index.ts#L586-L622","documentation":"The mock dev Context exposes params as a throwing getter because Astro routing (not Netlify) owns route params in this setup; the Netlify Context never carries usable path parameters, so reading context.params is rejected instead of returning empty or stale data.","triggerScenarios":"Destructuring or reading locals.runtime.context.params (e.g. const { slug } = context.params) in a page or endpoint during astro dev with the Netlify adapter.","commonSituations":"Functions code that used Netlify path parameters; assuming the adapter forwards route params into the Netlify Context; API helpers that try both Astro.params and context.params.","solutions":["Read route params from Astro.params (or context.params on Astro's middleware context)","Pass explicit values through locals when sharing data with helper functions","Remove Netlify Context param reads; they will never be populated in Astro"],"exampleFix":"// before\nconst { slug } = locals.runtime.context.params;\n// after\nconst { slug } = Astro.params;","handlingStrategy":"fallback","validationCode":"const ctx = locals.runtime?.context;\nconst isLocalDev = ctx?.deploy?.context === 'dev';\nconst slug = isLocalDev ? Astro.params.slug : (ctx!.params?.slug ?? Astro.params.slug);","typeGuard":"function safeNetlifyParams<P extends Record<string, any>>(context: any, fallback: P): P {\n  try {\n    return { ...fallback, ...(context.params ?? {}) };\n  } catch {\n    return fallback;\n  }\n}","tryCatchPattern":"let params = Astro.params;\ntry {\n  params = { ...params, ...locals.runtime.context.params };\n} catch {\n  // params getter throws in dev; Astro.params is authoritative anyway\n}","preventionTips":["Always read route params from Astro.params","Pass explicit arguments to helpers instead of re-deriving them from the Netlify Context","Never assume the adapter forwards routing data into context"],"tags":["netlify","local-dev","context","params","routing"],"backgroundTag":"unsupported-api-stub","analyzedSha":"3578d45d34226d63cff3d261c971c221de6794d2","analyzedAt":"2026-08-18T18:48:03.901Z","contentChangedAt":"2026-08-18T18:48:03.901Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}