[SOLVED] Can connect to compose.io on everything except iOS device?

I have been working on an application and using compose.io as my database platform. I am able connect to compose in web browser and iOS simulator with:

MONGO_URL="mongodb://myUsername:myPassword@aws-us-east-1-portal.6.dblayer.com:11391/dbName" meteor (run , run ios)

However when I try the same process with run ios-device --mobile-server, or ios-device --mobile-server -p 127.0.0.1:3000 it just keeps creating a local database instance.

Any ideas, is my command line string incorrect, or is a developer account required? Maybe something else.

Thanks!

Have you tried MONGO_URL="<...>" meteor run ios-device?

I haven’t tried that without --mobile-server at the end of the command. I will give that a go today and see if that makes a difference. I have been entering it in as follows:

MONGO_URL="mongodb://myUsername:myPassword@aws-us-east-1-portal.6.dblayer.com:11391/dbName" meteor run ios-device --mobile-server 127.0.0.1:3000

That won’t work. You’re telling the iOS device to connect to the server through the loopback interface.

meteor run should detect an external IP automatically, you only need to specify --mobile-server if that doesn’t work or if you want the app to connect to an existing server (not the development server).

Thanks for the suggestions, but removing --mobile-server did not work. I also tried specifying the connection string at the end of the --mobile-server but also did not work. I have data stored in compose.io which picks up during other connections , just does not seem to during this one.

Bahhh! this is killing me all I want is a solution. I noticed some people have their files hosted in other than local, possible there is an quirk that requires this for external db connection?

You seem to be confusing two things: the Meteor server you want the app to connect to, and the database you want the server to connect to. --mobile-server is only used for the former.

If your MONGO_URL setting works when connecting to the server from a browser or the iOS Simulator, the issue has to be somewhere else.

Are you sure your app is able to connect to the local development server? Is your server reachable over WiFi? What do you mean by it ‘creating a local database instance’? Are you talking about a MongoDB database on your development server, or in memory data on your device?

Ok I will itemize it, hopefully that clears things up some what.

WEB BROWSER - CONNECTS
MONGO_URL=“mongodb://myUsername:myPassword@aws-us-east-1-portal.6.dblayer.com:11391/dbName” meteor

iOS Simulator - CONNECTS
MONGO_URL=“mongodb://myUsername:myPassword@aws-us-east-1-portal.6.dblayer.com:11391/dbName” meteor run ios

iOS Device - DOES NOT CONNECT
MONGO_URL=“mongodb://myUsername:myPassword@aws-us-east-1-portal.6.dblayer.com:11391/dbName” meteor run ios-device

While running MONGO_URL=“connection-string” meteor run ios-device the app does not connect to the external database, but stores information on the local device (iphone) as far as I can tell. The data is not being picked up anywhere in the mongo CLI. So I am assuming somehow the phonegap/cordova framework is using local storage.

I also tried removing and deleting the cached data that could be picking up legacy settings. But no luck.

It seems no mater what I do for “meteor run ios-device” or how I arrange it, I can not connect. I don’t know if this helps in anyway, but I would be willing to share a code repo with you and compose access if you feel like going down that route via DM.

What I’m saying is that the connection from the development server to the the MongoDB does not seem to be the problem. I suspect the issue is that the device is not able to connect to the development server. In that case, the app will still use the in-memory database (minimongo). This is not specific to Cordova but part of the general Meteor architecture.

Have you tried removing the app from the device first? There is a bug in the current version of Meteor (fixed in 1.3), where an app always uses the last downloaded version of the asset bundle even if a newer bundled version is available. And because the index file that is part of the asset bundle specifies the ROOT_URL, it may then not pick up a change of IP address for instance.

The only other thing I can think of is that the device and your local machine are on different networks and the app cannot reach your development server.

1 Like

Hmmm… That would be interesting. Currently my device is connected to the same wifi connection as local machine. But I will try shutting of network connection for my device to force it onto wifi as no other connections will be available.

I have deleted the app from my iPhone using the typical (hold and press the “X” when prompted and installed a cache clear"). I’ll give all that a go and report back with any issues.

BOOM! Disabling cellular network and ensuring the device and local machine were on the same network, solved the issue

Sir, how do I buy you a cup of coffee?

Great to hear that solves it. I think we’re running into the limitations of online communication here, so a coffee emoji will do!

1 Like