supabase/supabase · warning
Method ${method} Not Allowed
Error message
Method ${method} Not Allowed What it means
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.
Source
Thrown at apps/studio/pages/api/platform/projects/[ref]/run-lints.ts:27
async function handler(req: NextApiRequest, res: NextApiResponse) {
const { method } = req
switch (method) {
case 'GET':
const { data, error } = await getLints({
headers: constructHeaders(req.headers),
exposedSchemas: DEFAULT_EXPOSED_SCHEMAS,
})
if (error) {
return res.status(400).json(error)
} else {
return res.status(200).json(data)
}
default:
res.setHeader('Allow', ['GET'])
res.status(405).json({ data: null, error: { message: `Method ${method} Not Allowed` } })
}
}
View on GitHub (pinned to beee91b9c2)
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.
Example fix
// before
await fetch(`/api/platform/projects/${ref}/run-lints`, { method: 'POST' })
// after — lints are fetched via GET
await fetch(`/api/platform/projects/${ref}/run-lints`) Defensive patterns
Strategy: validation
Validate before calling
if (req.method !== 'GET') {
throw new Error('run-lints only supports GET; lints are recomputed on each request')
} Type guard
function isLintFetchMethod(method: string): method is 'GET' {
return method === 'GET'
} Prevention
- Lints are computed server-side on each GET — use React Query refetch/invalidation to refresh, not POST.
- Check the Allow header on 405 responses.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Method ${method} Not Allowed
- Method ${method} Not Allowed
- Method ${method} Not Allowed
- Method ${method} Not Allowed
- Method ${method} Not Allowed
AI-assisted analysis of supabase/supabase@beee91b9c2 (2026-08-12).
Data as JSON: /api/errors/6cc6567a51c787d4.
Report an issue: GitHub.