You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tested hono with trpc inside a lambda and everything is working well except when I try to add the cors middleware.
I get this error message
Access to fetch at '' from origin 'http://localhost:3000' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header contains multiple values 'http://localhost:3000, *', but only one is allowed. Have the server send the header with a valid value, or, if an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
In the browser I have this
Here's the code
import{Hono}from"hono";import{handle}from"hono/aws-lambda";import{cors}from"hono/cors";import{trpcServer}from"@hono/trpc-server";import{appRouter}from"./trpc/trpc";constapp=newHono();app.use(cors({// Only frontend is allowedorigin: ["http://localhost:3000"],}));app.use("/trpc/*",trpcServer({router: appRouter,}));exportconsthandler=handle(app);
The text was updated successfully, but these errors were encountered:
TheUncharted
changed the title
[Cors] The 'Access-Control-Allow-Origin' header contains multiple values 'http://localhost:3000, *', but only one is allowed
[Trpc Server + Cors] The 'Access-Control-Allow-Origin' header contains multiple values 'http://localhost:3000, *', but only one is allowed
May 1, 2024
Hi
I tested hono with trpc inside a lambda and everything is working well except when I try to add the cors middleware.
I get this error message
In the browser I have this
Here's the code
The text was updated successfully, but these errors were encountered: