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

2 years 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.

Closed

90 Replies

hskang9
PROOP

2 years ago

b91027b8-2750-44ef-9b93-e63f8c1d9b6d


2 years ago

send the domain in question please



hskang9
PROOP

2 years ago

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


2 years ago

have you verified that the cors headers are being set?


hskang9
PROOP

2 years ago

the server code is in the picture


hskang9
PROOP

2 years ago

how do I verify that tho


2 years ago

check the headers returned


hskang9
PROOP

2 years ago

1302396892029911050


hskang9
PROOP

2 years ago

this is the header


2 years ago

where can I see this error for myself


hskang9
PROOP

2 years ago

I run a web app in localhost


2 years ago

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


hskang9
PROOP

2 years ago

1302398866968281118


hskang9
PROOP

2 years ago

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


hskang9
PROOP

2 years ago

but the result is same


hskang9
PROOP

2 years ago

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


hskang9
PROOP

2 years ago

do you need code to deploy this server?


2 years ago

^


hskang9
PROOP

2 years ago

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


hskang9
PROOP

2 years ago

or I can spin up website


2 years ago

it looks like you already run it on vercel?


hskang9
PROOP

2 years ago

the frontend?


2 years ago

yes


hskang9
PROOP

2 years ago

no, this error is from localhost


2 years ago

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


hskang9
PROOP

2 years ago

oh


hskang9
PROOP

2 years ago

this is the previous one


hskang9
PROOP

2 years ago

now with test-cors


hskang9
PROOP

2 years ago

give me a min, it is building now


hskang9
PROOP

2 years ago


2 years ago

and what do i do to see the cors error?


hskang9
PROOP

2 years ago

1302401692452524072


hskang9
PROOP

2 years ago

you need to connect wallet


hskang9
PROOP

2 years ago

but you can do that with google login


2 years ago

im sorry but thats outside of what id like to do


hskang9
PROOP

2 years ago

1302401868319690814


hskang9
PROOP

2 years ago

what help do you need?


2 years ago

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


hskang9
PROOP

2 years ago

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


hskang9
PROOP

2 years ago

curl -X POST https://test-cors.standardweb3.com/graphql

-H "Content-Type: application/json"

-d '{"query": "{ hello }"}'


hskang9
PROOP

2 years ago

maybe you can try this?


hskang9
PROOP

2 years ago

try this curl request


hskang9
PROOP

2 years 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
PROOP

2 years ago

hey I just added a code to create error


hskang9
PROOP

2 years ago

@Brody



hskang9
PROOP

2 years ago

here


hskang9
PROOP

2 years ago

go to this website


hskang9
PROOP

2 years ago

then open developer console


hskang9
PROOP

2 years ago

hello


hskang9
PROOP

2 years ago

hello


hskang9
PROOP

2 years ago

please


2 years ago

there are no cors headers


2 years ago

1302407147740598384


hskang9
PROOP

2 years ago

but in prefetch there is


2 years ago

right but thats irrelevant


hskang9
PROOP

2 years ago

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


2 years ago

i dont know, you would need to consult their docs


hskang9
PROOP

2 years ago

Ok thank you, I should ask the team


hskang9
PROOP

2 years ago

but somehow curl requests are working fine


2 years ago

curl does not care about cors, cors is for browsers


hskang9
PROOP

2 years ago

but I don't understand


hskang9
PROOP

2 years ago

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


hskang9
PROOP

2 years ago

works fine without cors issue


2 years ago

^


hskang9
PROOP

2 years ago

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


hskang9
PROOP

2 years ago

is there a way to get file in that


hskang9
PROOP

2 years ago

deployment


hskang9
PROOP

2 years ago

even with same github repo, somehow it works the same


2 years ago

this is an application level issue


hskang9
PROOP

2 years ago

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


2 years ago

because it worked then and your latest code broke something


2 years ago

either way, this is not a platform issue


hskang9
PROOP

2 years ago

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


hskang9
PROOP

2 years ago

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


2 years ago

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


hskang9
PROOP

2 years ago

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


hskang9
PROOP

2 years ago

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


hskang9
PROOP

2 years ago

only recent deployment with same code is making problem on CORS


2 years ago

I'm sorry but this is an application level issue


hskang9
PROOP

2 years ago

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


2 years 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
PROOP

2 years ago

ok


2 years ago

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


hskang9
PROOP

2 years ago

I found error


2 years ago

what was the error?


hskang9
PROOP

2 years ago

hono server was broken


hskang9
PROOP

2 years ago

their code was not working


2 years ago

strange, glad you found a fix


Welcome!

Sign in to your Railway account to join the conversation.

Loading...