-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: responseMeta sets wrong value to AllowOrigin CORS header #5717
Comments
Your repo doesn't seem to include responseMeta? https://github.com/gnllucena/trpc-sst/blob/main/apps%2Fserver%2Findex.ts |
Hello, Katt, thank you for you quick reply! It seem's that you're looking at the main branch. The repo has a feat/cors branch with the described issue. Would it be better if I merge that to main? Edit: I have updated that reproduction steps to describe the branch change |
Hey @gnllucena I wasn't able to test your example because I don't have sst setup. It was easier to do an example test of the lambda adapter - you can see in #5721 trpc/packages/tests/server/adapters/awsLambda.test.tsx Lines 516 to 527 in c08f7b3
The exact result we return to the lambda is this: trpc/packages/tests/server/adapters/awsLambda.test.tsx Lines 540 to 549 in c08f7b3
Do you see anything wrong? I doubt somehow that this is us doing something wrong. Headers keys are case insensitive per definition but maybe AWS requires proper casing somehow? Otherwise, I'm clueless. |
This issue was posted in the SST Discord as well, it's most likely a problem caused by SST Ion because it sets a default CORS configuration on AWS Lambda Function URL's. The most likely solution is to disable CORS in SST https://ion.sst.dev/docs/component/aws/function/#url. |
Hey there! 👋 We appreciate the time you've taken to write this issue. Unfortunately, we don't have the capacity to assist here as this issue does not seem to be related to tRPC itself. Please feel free to re-open if you do think this is a bug help or write in our help channel on Discord or in our GitHub Discussions. |
I can confirm the fix. Thanks for the help @KATT @arpadgabor |
This issue has been locked because we are very unlikely to see comments on closed issues. If you are running into a similar issue, please create a new issue. Thank you. |
Provide environment information
Describe the bug
When I set AllowOrigin headers instead of having only the value I set,
responseMeta
also adds*
Repo with reproduction: https://github.com/gnllucena/trpc-sst/blob/b2467045c71fdb8591830b73d278e309076e2c27/apps/server/index.ts#L5C1-L21C3
Access to fetch at 'https://jlh3dwfayd3z4inbuzrgkta4a40bspmf.lambda-url.us-east-2.on.aws/greet?batch=1&input=%7B%7D' from origin 'http://localhost:5173' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header contains multiple values 'http://localhost:5173, *', 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.
Link to reproduction
https://github.com/gnllucena/trpc-sst/tree/feat/cors
To reproduce
Install Ion
Install pnpm
Run the project
Go to http://localhost:5173
Additional information
No response
👨👧👦 Contributing
Funding
The text was updated successfully, but these errors were encountered: