Closed santhoshkumarguna closed 6 months ago
Hi @santhoshkumarguna - in your site_config.json allow requests from the frontend URL for CORS. I think the key would be "allow_cors". You would need to mention both URLs in site_config
Hi @nikkothari22 in my react application the web socket url being like this https://chat-test.fr8.in/socket.io/?EIO=4&transport=polling&t=OmKCtiI
when i see the chat on separate site web socket url being like this wss://draven.fr8.in/socket.io/?EIO=4&transport=websocket&sid=SXUvTL-yMs9cHnxGAdTL
I put that you provided code still i getting cors error.
In frappe socket configuration code blocks like this
Hey @santhoshkumarguna
Did you add the URL to your allow CORS list in your site_config.json? Can you share that?
This error is not related to the SDK or the frontend. It's the server that's not accepting the request because it's cross origin.
This is my site_config.json file
{ "db_name": "_d1202f0547830600", "db_password": "Wr0BQWKvbpg0kQj9", "db_type": "mariadb", "encryption_key": "maZ4BxtH0RIbOzekEVZ0PG49B5x-l1PeFQzPnJkFwww=", "maintenance_mode": 0, "throttle_user_limit": 500, "allow_cors": "https://dgrow.fr8.in" }
I allowed my origin. now cors error has gone but my websocket is not subscribing. not able to listen realtime updates.
Unrelated to this but you should have two URL's in your allow_cors - one is your frontend the other is your main frappe server.
This seems like a CORS issue for socket.io in Frappe, rather than an issue with Frappe React SDK. You would have to debug if you can connect to socket directly from a separate origin (without the SDK) - I think that won't work, maybe because Frappe does not check for the allow CORS flag for Socket. (Similarly, API Key secret auth does not work with Socket on Frappe).
If you're not able to connect using Socket to Frappe from a different origin, then the issue is with the framework and not the SDK.
i have configured frappe provider for my react application and then my frappe server is running on separate url. now i am getting cors error.
below error got from my network.
This is my source code.![image](https://github.com/The-Commit-Company/frappe-react-sdk/assets/98941581/36f6d0bb-5b0b-43c6-8b61-a72e541a0c79)
Kindly help me to solve this issue.