I need help on my railway project keep throwing cors error even with proper setup

hskang9
PRO

8 months ago

I set up hono backend with cors setitng to allow all origin, but somehow when I accessed the server with the domain set, it keeps returning cors error with 200 response.

0 Replies

hskang9
PRO

8 months ago

b91027b8-2750-44ef-9b93-e63f8c1d9b6d


8 months ago

send the domain in question please



hskang9
PRO

8 months ago

I set with railway, and other project such as 4c028fe8-0273-420a-84cc-be5ea253616c works fine without extra configuration


8 months ago

have you verified that the cors headers are being set?


hskang9
PRO

8 months ago

the server code is in the picture


hskang9
PRO

8 months ago

how do I verify that tho


8 months ago

check the headers returned


hskang9
PRO

8 months ago

1302396892029911000


hskang9
PRO

8 months ago

this is the header


8 months ago

where can I see this error for myself


hskang9
PRO

8 months ago

I run a web app in localhost


8 months ago

I'm sorry but that doesn't really answer my question


hskang9
PRO

8 months ago

1302398866968281000


hskang9
PRO

8 months ago

I recently switched the server url to be this test-cors.standardweb3.com


hskang9
PRO

8 months ago

but the result is same


hskang9
PRO

8 months ago

I do not understand. the header already has Access-Control-Allow-Origin property


hskang9
PRO

8 months ago

do you need code to deploy this server?


8 months ago

^


hskang9
PRO

8 months ago

I think you have to run an app that I develop and open developer console


hskang9
PRO

8 months ago

or I can spin up website


8 months ago

it looks like you already run it on vercel?


hskang9
PRO

8 months ago

the frontend?


8 months ago

yes


hskang9
PRO

8 months ago

no, this error is from localhost


8 months ago

look at the image in the root post, that's vercel


hskang9
PRO

8 months ago

oh


hskang9
PRO

8 months ago

this is the previous one


hskang9
PRO

8 months ago

now with test-cors


hskang9
PRO

8 months ago

give me a min, it is building now


hskang9
PRO

8 months ago


8 months ago

and what do i do to see the cors error?


hskang9
PRO

8 months ago

1302401692452524000


hskang9
PRO

8 months ago

you need to connect wallet


hskang9
PRO

8 months ago

but you can do that with google login


8 months ago

im sorry but thats outside of what id like to do


hskang9
PRO

8 months ago

1302401868319690800


hskang9
PRO

8 months ago

what help do you need?


8 months ago

i need an easy way to see the cors error for myself


hskang9
PRO

8 months ago

I am not sure how to make curl request on graph ql


hskang9
PRO

8 months ago

curl -X POST https://test-cors.standardweb3.com/graphql \
-H "Content-Type: application/json" \
-d '{"query": "{ hello }"}'


hskang9
PRO

8 months ago

maybe you can try this?


hskang9
PRO

8 months ago

try this curl request


hskang9
PRO

8 months ago

curl -X POST https://test-cors.standardweb3.com \
-H "Content-Type: application/json" \
-d '{
"query": "query GetTradeHistorysCursor($maker: String!, $after: String, $limit: Int) { account(id: $maker) { totalTradeHistory tradeHistory(orderBy: \"timestamp\", orderDirection: \"desc\", after: $after, limit: $limit) { pageInfo { startCursor hasPreviousPage hasNextPage endCursor } } } }",
"variables": {
"maker": "0xF8FB4672170607C95663f4Cc674dDb1386b7CfE0",
"limit": 10
}
}'


hskang9
PRO

8 months ago

hey I just added a code to create error


hskang9
PRO

8 months ago

@Brody



hskang9
PRO

8 months ago

here


hskang9
PRO

8 months ago

go to this website


hskang9
PRO

8 months ago

then open developer console


hskang9
PRO

8 months ago

hello


hskang9
PRO

8 months ago

hello


hskang9
PRO

8 months ago

please


8 months ago

there are no cors headers


8 months ago

1302407147740598300


hskang9
PRO

8 months ago

but in prefetch there is


8 months ago

right but thats irrelevant


hskang9
PRO

8 months ago

that is weird, prefetch had header configured from the hono code, then why is it missing?


8 months ago

i dont know, you would need to consult their docs


hskang9
PRO

8 months ago

Ok thank you, I should ask the team


hskang9
PRO

8 months ago

but somehow curl requests are working fine


8 months ago

curl does not care about cors, cors is for browsers


hskang9
PRO

8 months ago

but I don't understand


hskang9
PRO

8 months ago

same code with project id 4c028fe8-0273-420a-84cc-be5ea253616c


hskang9
PRO

8 months ago

works fine without cors issue


8 months ago

^


hskang9
PRO

8 months ago

I don't know what is happening, but the file in that deployment works well without cors issue


hskang9
PRO

8 months ago

is there a way to get file in that


hskang9
PRO

8 months ago

deployment


hskang9
PRO

8 months ago

even with same github repo, somehow it works the same


8 months ago

this is an application level issue


hskang9
PRO

8 months ago

if this is an application level issue, why is cors working in the current rollback deployment of 4c028fe8-0273-420a-84cc-be5ea253616c


8 months ago

because it worked then and your latest code broke something


8 months ago

either way, this is not a platform issue


hskang9
PRO

8 months ago

I disagree, all the working code is same with branch from main in the github standard-ponder repo


hskang9
PRO

8 months ago

but somehow the recent deployment with the same code showed cors error


8 months ago

if we broke cors for our users applications we would be seeing hundreds of reports pour in


hskang9
PRO

8 months ago

270493b7-d141-4d1c-839e-e1802888bbff


hskang9
PRO

8 months ago

this project also uses the same code from the main branch of the github repo standard-ponder


hskang9
PRO

8 months ago

only recent deployment with same code is making problem on CORS


8 months ago

I'm sorry but this is an application level issue


hskang9
PRO

8 months ago

ok but I don't really understand why only the recent deployment with the same code is causing a problem


8 months ago

to be honest, I don't either, I don't know enough about your code to tell you the issue unfortunately, but that doesn't change my previous statement


hskang9
PRO

8 months ago

ok


8 months ago

i wish you the best of luck while you debug this issue with your app


hskang9
PRO

8 months ago

I found error


8 months ago

what was the error?


hskang9
PRO

8 months ago

hono server was broken


hskang9
PRO

8 months ago

their code was not working


8 months ago

strange, glad you found a fix