Server connect in NodeJS not working on ios app

======== TEMPLATE BUG FORM ========

Wappler Version : 3.1.0
Operating System : osx 10.15 -> target device testing 13.6
xcode 11.6
cordova 6
node.js
postgresql

Expected behavior

What do you think should happen?

The data from my server connect should be loaded into list on mobile app. I have no restrictions in my config file. The data is being loaded fine inside both the data/back end project for the mobile app (on herokuapp.com/api + herokuapp.index) & the mobile project. I can tell the app is not restricting data since i am using an external font loaded from s3 url. This is really holding my project back, I have spent few days with no answer.

Experiening the same here:

Actual behavior

What actually happens?

It is not loaded, hard for me to debug any browser errors since it’s inside of the ios app webview.

How to reproduce

Create a mobile project and connect it to dynamic data project as described in this guide:

Make the app target to ios latest. Use postgresql database with node.js server.

run cordova build ios

open up the project in xcode

click build/run onto a physical device & see there is no server data. (I can’t test to see if it works from simulator, it loads too slow and crashes my computer).

Sound like you may not have published your node.js project to a live server?

Hi thanks for trying to help me troubleshoot.
My node.js data project is deployed to heroku.
On the index page (live not wappler editor) I am using the same server connect to display data in a repeat and this is working fine.

Maybe you should review this topic:

I think some CORS options should be set.

Maybe @patrick can check this for NodeJS

1 Like

Hi Patrick did you get the time to look at my problem yet?

I don’t have much experience with the webviews on mobile, but it is probably a cors issue.

You can try to enable cors in the node app. There is a middleware for expressjs https://expressjs.com/en/resources/middleware/cors.html.

To install you have to install cors using npm. Then edit the server.js file in the lib folder, add const cors = require('cors') somewhere on top and then app.use(cors()) just before the other app.use code.

Let me know if it works or when you have problems installing it.

1 Like

I will give that a try thanks.

Could also try deleting the ‘cordova-plugins-whitelist’ directory contained within the Plugins directory in the root of your Project structure then Build the Project again. This Plugin will be automatically added again upon executing Build. Quite often this Plugin becomes somewhat confused which can lead you down all type of time-wasting rabbit holes where CORS is concerned…

:wink:

1 Like

I have installed cors via npm to my system and included on server.js like instructed.

But now when viewing either the data project or the mobile project (inside Wappler) I have an error, failed to load resource, when before adding cors this was working fine and I could preview data from my postgres db.


Is there something else I need to configure on html/ejs side?

I removed cors, used cordova plugin remove whitelist to delete the directory. Built again, run the app with xcode and still no data inside my repeat.

Did you also install the cors package on the server?

We will include cors with the next update, it will then be configurable in Wappler.

1 Like

I fixed it now :slight_smile: I just needed to include as dependency in package.json so I edited manually

.