ojasaklechayt / Oju-s-Blogs

A full MERN Stack Blogging website to write out yourself
https://oju-blogs.vercel.app
10 stars 14 forks source link

Cors Error while Adding Blog #28

Open ojasaklechayt opened 10 months ago

ojasaklechayt commented 10 months ago

Checkout #24 While uploading the new blog, we are facing the cors error. image

ojasaklechayt commented 10 months ago

@aasimtaif guys while sending the post request, I am getting this errors. Can you please check because, since you have worked with this, you might have better idea with it.

aasimtaif commented 10 months ago

sorry I do not understand the error Desktop-1698084965639.webm As you can see in video it is working perfectly fine

aasimtaif commented 10 months ago

Checkout #24 While uploading the new blog, we are facing the cors error. image

When I tried this problem did not happen during blog upload but during the blog edit

ojasaklechayt commented 10 months ago

Checkout #24 While uploading the new blog, we are facing the cors error. image

When I tried this problem did not happen during blog upload but during the blog edit

This I feel is the cors error which comes when using external APIs. I have already added the cors property in the backend but don't know which it still is coming.

aasimtaif commented 10 months ago

This happened to you during blog upload ??

ojasaklechayt commented 10 months ago

yep @aasimtaif I have also tried updating this code but this is still happening

aasimtaif commented 10 months ago

It is not happening for me can you show the network tab to see response from backend

ojasaklechayt commented 10 months ago

It is not happening for me can you show the network tab to see response from backend

It give internal server error - 500 to me

aasimtaif commented 10 months ago

Then I think it a backend problem I will look into the issue first thing in the morning

aasimtaif commented 10 months ago

the above error occurs when you try to upload a large size image To resolve you have to increase the request size in the backend If I try to upload an image size of 170kb it gives me an error

ojasaklechayt commented 10 months ago

the above error occurs when you try to upload a large size image To resolve you have to increase the request size in the backend If I try to upload an image size of 170kb it gives me an error

I see, can you make PR ? I will merge it.

ojasaklechayt commented 10 months ago

@aasimtaif Yes the code is working, actually the issue is that in the cors setting in the backend we have specified the frontend url and during the pr preview it uses different frontend url, hence giving the cors error. I feel it would be great if we can make the cors property general instread of specified for the main frontend url. Also I am closing the #32 pr since I have merged your latest pr, the changes of #32 pr is already been updated in the code.