sbace
sbace2w ago

tRPC CORS error

Hello, I have tRPC setup with express.js and next.js (as the client) within a turborepo and tRPC as a shared package. What am I doing wrong to get a cors error. Any help would be appreciated.
No description
No description
No description
2 Replies
Spoonman
Spoonman2w ago
Install the cors express middleware package in your server and add your client to the allowlist.
app.use(cors({ origin: "http://localhost:3000" }))
app.use(cors({ origin: "http://localhost:3000" }))
https://www.npmjs.com/package/cors
sbace
sbaceOP2w ago
I have it on my server already, but still not working