{"record":{"id":"4d34bf4bf35f1cd9","repo":"withastro/astro","slug":"your-vercel-json-config-is-not-a-valid-json-file","errorCode":null,"errorMessage":"Your \"vercel.json\" config is not a valid json file.","messagePattern":"Your \"vercel\\.json\" config is not a valid json file\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/integrations/vercel/src/index.ts","lineNumber":375,"sourceCode":"\t\t\t\t\t\tconfig.trailingSlash !== 'ignore' &&\n\t\t\t\t\t\texistsSync(vercelConfigPath)\n\t\t\t\t\t) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst vercelConfig = JSON.parse(readFileSync(vercelConfigPath, 'utf-8'));\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t(vercelConfig.trailingSlash === true && config.trailingSlash === 'never') ||\n\t\t\t\t\t\t\t\t(vercelConfig.trailingSlash === false && config.trailingSlash === 'always')\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tlogger.error(\n\t\t\t\t\t\t\t\t\t`\n\tYour \"vercel.json\" \\`trailingSlash\\` configuration (set to \\`${vercelConfig.trailingSlash}\\`) will conflict with your Astro \\`trailingSlash\\` configuration (set to \\`${JSON.stringify(config.trailingSlash)}\\`).\n\tThis would cause infinite redirects or duplicate content issues. \n\tPlease remove the \\`trailingSlash\\` configuration from your \\`vercel.json\\` file or Astro config.\n`,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} catch (_err) {\n\t\t\t\t\t\t\tlogger.warn(`Your \"vercel.json\" config is not a valid json file.`);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tsetAdapter(\n\t\t\t\t\t\tgetAdapter({\n\t\t\t\t\t\t\tbuildOutput: _buildOutput,\n\t\t\t\t\t\t\tmiddlewareMode: resolvedMiddlewareMode,\n\t\t\t\t\t\t\tskewProtection,\n\t\t\t\t\t\t\tstaticHeaders: staticHeaders,\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tsetAdapter(\n\t\t\t\t\t\tgetAdapter({\n\t\t\t\t\t\t\tmiddlewareMode: resolvedMiddlewareMode,\n\t\t\t\t\t\t\tskewProtection,\n\t\t\t\t\t\t\tbuildOutput: _buildOutput,\n\t\t\t\t\t\t\tstaticHeaders: staticHeaders,\n\t\t\t\t\t\t}),","sourceCodeStart":357,"sourceCodeEnd":393,"githubUrl":"https://github.com/withastro/astro/blob/3578d45d34226d63cff3d261c971c221de6794d2/packages/integrations/vercel/src/index.ts#L357-L393","documentation":"The Vercel adapter reads vercel.json during build to compare its `trailingSlash` setting against Astro's and warn about conflicts that would cause redirect loops or duplicate content. If vercel.json exists but is not strict JSON (comments, trailing commas, syntax typos), the read throws, is caught here, and this warning is emitted. The trailingSlash conflict check is silently skipped and the adapter proceeds with defaults.","triggerScenarios":"Running `astro build` with @astrojs/vercel while vercel.json contains JSONC syntax (comments, trailing commas) or a parse error.","commonSituations":"Hand-editing vercel.json and leaving a comment; JSONC habits from other config files; the trailingSlash conflict the check exists for then goes undetected.","solutions":["Make vercel.json strict JSON: remove comments and trailing commas","Validate locally: `node -e \"JSON.parse(require('fs').readFileSync('vercel.json','utf8'))\"`","Re-run the build — if you had a trailingSlash mismatch, you should now see the real conflict error","Prefer configuring trailingSlash once in astro.config and removing it from vercel.json"],"exampleFix":"// before: vercel.json (invalid JSON)\n{\n  // comment not allowed\n  \"trailingSlash\": true,\n}\n\n// after\n{\n  \"trailingSlash\": true\n}","handlingStrategy":"validation","validationCode":"// CI step: vercel.json must be strict JSON\nimport { readFileSync } from 'node:fs';\nJSON.parse(readFileSync('vercel.json', 'utf8')); // throws on comments/trailing commas","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never put comments or trailing commas in vercel.json","Configure trailingSlash in one place only — preferably astro.config","Add a JSON.parse lint for every config file the adapter reads"],"tags":["vercel","json","config","trailing-slash"],"backgroundTag":"config-json-parse-error","analyzedSha":"3578d45d34226d63cff3d261c971c221de6794d2","analyzedAt":"2026-08-18T18:48:03.901Z","contentChangedAt":"2026-08-18T18:48:03.901Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}