I’ll try to explain this in a very simple way.
I’ve read all the topics related to cors.
Trust me when I say I’m a little embarrased on creating another topic with this title.
I have a php project with a query, uploaded to my domain with mobile cors as suggested.
On my mobile project, I call it via SC, and displays all the data I need (On the Wappler preview)
But not on chrome DUE TO CORS, Wappler android emulator, android studio emulator, released apk.
Going to device inspector (From wappler android emulator) I see:
Uncaught TypeError: Cannot read property 'triggerEvent' of undefined
at <anonymous>:1:18
Failed to load resource: net::ERR_CLEARTEXT_NOT_PERMITTED
So I change the cors to *
Now the data is displaying on the browser (chrome), on wappler preview, but not on Wappler android emulator, android studio emulator, o released apk. (I see the same as above)
I think I’m gonna lose my mind here, please, anybody?
Thanks but I see it works on cordova, not on capacitor.
I’ve read all the docs related, but can’t figure it out.
It’s a simple query with * on the sc, it should be more easy to understand.
Will re read, and try tomorrow since it’s late here.
Thanks again folks
Well, I found the solution and want to share (cause I can’t be more happy):
Wappler preview (on browser) is on localhost:#### so that is a problem related to cors.
I think there’s no chance to allow ports on cors with a wildcard .
I assume as always there is a workaround like adding (:\d{1,5})?$.
There is a FR for capacitor static localhost port.
The thing is: the port changes when we open the mobile project, so going to edit cors on the other project on Wappler is a waste of time cause when we re-open the mobile project, the port changes to another. The fix is using an external editor for editing that cors origin.
Can you believe android emulator comes with no internet connected? It was just a simple and obviously step I didn’t see. That’s why the error not_permitted/resolved
When editing cors, o debug option, related to config.php file under dmxConnect, it seems that there’s no closing tag on php structure (Opening a bug report)
The third point was the critical one for me I guess.
Apk running with server connect api.
That’s a nice post, but somehow:
I create from scratch a project, and with those 3 steps above, I released an apk with android studio with great functions.
The localhost port is a KEY on this for testing, please consider a static port for mobile projects (and adding that to cors obviously, but that looks a little complicated right?)