{"record":{"id":"e541b5e26d858ce4","repo":"supabase/supabase","slug":"method-method-not-allowed-e541b5","errorCode":null,"errorMessage":"Method ${method} Not Allowed","messagePattern":"Method (.+?) Not Allowed","errorType":"http","errorClass":null,"httpStatus":405,"severity":"info","filePath":"apps/studio/pages/api/platform/integrations/github/connections.ts","lineNumber":16,"sourceCode":"import { paths } from 'api-types'\nimport { NextApiRequest, NextApiResponse } from 'next'\n\nimport { apiWrapper } from '@/lib/api/apiWrapper'\n\nexport default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler)\n\nasync function handler(req: NextApiRequest, res: NextApiResponse) {\n  const { method } = req\n\n  switch (method) {\n    case 'GET':\n      return handleGet(req, res)\n    default:\n      res.setHeader('Allow', ['GET'])\n      res.status(405).json({ data: null, error: { message: `Method ${method} Not Allowed` } })\n  }\n}\n\ntype ResponseData =\n  paths['/platform/integrations/github/connections']['get']['responses']['200']['content']['application/json']\n\nconst handleGet = async (_req: NextApiRequest, res: NextApiResponse<ResponseData>) => {\n  return res.status(200).json({ connections: [] })\n}\n","sourceCodeStart":1,"sourceCodeEnd":26,"githubUrl":"https://github.com/supabase/supabase/blob/beee91b9c2228dd57302dec75c733baaa84ab543/apps/studio/pages/api/platform/integrations/github/connections.ts#L1-L26","documentation":"HTTP 405 from the GitHub connections list route. Only GET is handled (returns `{ connections: [] }` in the local mock); any other verb returns `{ data: null, error: { message: 'Method ${method} Not Allowed' } }` with Allow: GET. Read-only listing of GitHub org/repo connections.","triggerScenarios":"POST to add a connection, DELETE to remove one, or PATCH to update — all to /api/platform/integrations/github/connections.","commonSituations":"A 'Connect repository' dialog POSTing to the list endpoint instead of the platform connection endpoint; assuming the local mock persists writes; tests that POST to seed a connection.","solutions":["GET this route to list existing connections only.","Send add/remove operations to the real platform connection endpoint, not this read-only mock.","Model the call as a query (useQuery), not a mutation, in the Studio data layer.","Confirm the UI is targeting the correct writable URL for connect/disconnect."],"exampleFix":"// before\nawait fetch('/api/platform/integrations/github/connections', { method: 'POST', body: JSON.stringify({ repo }) })\n\n// after\nconst res = await fetch('/api/platform/integrations/github/connections')\nconst { connections } = await res.json()","handlingStrategy":"validation","validationCode":"if (method.toUpperCase() !== 'GET') {\n  throw new Error('github/connections is a GET list')\n}","typeGuard":"type GithubConnectionsMethod = 'GET'\nfunction isGithubConnectionsMethod(m: string): m is GithubConnectionsMethod {\n  return m.toUpperCase() === 'GET'\n}","tryCatchPattern":"const res = await fetch('/api/platform/integrations/github/connections')\nif (res.status === 405) {\n  throw new Error('Connections list is GET-only; add/remove on the platform endpoint')\n}","preventionTips":["Use GET to list GitHub connections.","Send connect/disconnect mutations to the platform connection endpoint.","Keep reads as queries in data/fetchers.ts."],"tags":["http-405","nextjs-api-route","integrations","github","read-only","mock","method-mismatch"],"backgroundTag":null,"analyzedSha":"beee91b9c2228dd57302dec75c733baaa84ab543","analyzedAt":"2026-08-12T06:51:48.935Z","schemaVersion":2},"datasetVersion":"2026-08-12T12:31:55.035Z"}