CORS
If your frontend calls an API on a different domain and the browser shows a CORS error, the API server hasn't allowed your origin. It's a browser rule, so the fix is on the server, not in your fetch call. If you don't control the API, call it from your own backend or Next.js API route instead.
// Browser console error:
// Access to fetch at 'https://api.other.com' from origin
// 'http://localhost:3000' has been blocked by CORS policy
// Fix 1: the API server allows your origin (Express)
app.use(cors({ origin: "http://localhost:3000" }))
// Fix 2: proxy through your own Next.js route
// app/api/weather/route.ts
export async function GET() {
const res = await fetch("https://api.other.com/weather")
return Response.json(await res.json())
}