{"record":{"id":"6cc6567a51c787d4","repo":"supabase/supabase","slug":"method-method-not-allowed-6cc656","errorCode":null,"errorMessage":"Method ${method} Not Allowed","messagePattern":"Method (.+?) Not Allowed","errorType":"http","errorClass":null,"httpStatus":405,"severity":"warning","filePath":"apps/studio/pages/api/platform/projects/[ref]/run-lints.ts","lineNumber":27,"sourceCode":"\nasync function handler(req: NextApiRequest, res: NextApiResponse) {\n  const { method } = req\n\n  switch (method) {\n    case 'GET':\n      const { data, error } = await getLints({\n        headers: constructHeaders(req.headers),\n        exposedSchemas: DEFAULT_EXPOSED_SCHEMAS,\n      })\n\n      if (error) {\n        return res.status(400).json(error)\n      } else {\n        return res.status(200).json(data)\n      }\n    default:\n      res.setHeader('Allow', ['GET'])\n      res.status(405).json({ data: null, error: { message: `Method ${method} Not Allowed` } })\n  }\n}\n","sourceCodeStart":9,"sourceCodeEnd":30,"githubUrl":"https://github.com/supabase/supabase/blob/beee91b9c2228dd57302dec75c733baaa84ab543/apps/studio/pages/api/platform/projects/[ref]/run-lints.ts#L9-L30","documentation":"This run-lints route accepts only GET (to retrieve lint results). Any other HTTP method hits the default case, which sets Allow: ['GET'] and returns 405 with \"Method ${method} Not Allowed\". Lints are computed server-side via pg-meta SQL — there is no write or re-run endpoint here.","triggerScenarios":"Sending POST to trigger a lint re-run, or DELETE/PUT to `/api/platform/projects/{ref}/run-lints`. A client attempting to invalidate or refresh lints via a non-GET method.","commonSituations":"Client code assuming lints can be triggered via POST. A stale API contract after a Studio version upgrade. Confusion between the lint run endpoint and a lint rule configuration endpoint.","solutions":["Use GET to retrieve lint results — lints are recomputed on each GET request.","If lints appear stale, check the React Query cache invalidation strategy rather than changing the HTTP method.","Confirm via the Allow: ['GET'] response header."],"exampleFix":"// before\nawait fetch(`/api/platform/projects/${ref}/run-lints`, { method: 'POST' })\n\n// after — lints are fetched via GET\nawait fetch(`/api/platform/projects/${ref}/run-lints`)","handlingStrategy":"validation","validationCode":"if (req.method !== 'GET') {\n  throw new Error('run-lints only supports GET; lints are recomputed on each request')\n}","typeGuard":"function isLintFetchMethod(method: string): method is 'GET' {\n  return method === 'GET'\n}","tryCatchPattern":null,"preventionTips":["Lints are computed server-side on each GET — use React Query refetch/invalidation to refresh, not POST.","Check the Allow header on 405 responses."],"tags":["http-405","method-not-allowed","nextjs-api-route","self-hosted","lints"],"backgroundTag":null,"analyzedSha":"beee91b9c2228dd57302dec75c733baaa84ab543","analyzedAt":"2026-08-12T06:51:48.935Z","schemaVersion":2},"datasetVersion":"2026-08-12T12:31:55.035Z"}