src/pages/api/trpc/[trpc].ts
export default async function handler( req: NextApiRequest, res: NextApiResponse) { res.setHeader("Access-Control-Allow-Origin", "*"); res.setHeader("Access-Control-Allow-Credentials", "true"); res.setHeader("Access-Control-Request-Method", "*"); res.setHeader("Access-Control-Allow-Methods", "OPTIONS, GET"); res.setHeader("Access-Control-Allow-Headers", "*"); if (req.method === "OPTIONS") { res.writeHead(200); return res.end(); } return nextApiHandler(req, res);}
response body is not available to scripts (Reason: CORS No Allow Credentials)