Cody Higdem Cody Higdem - 2 months ago 38x
Android Question

Meteor Mobile App cannot connect to server

I'm having a series of issues connecting to my server using android, ios and iOS simulator. After several days of off again and on again searching for a way to resolve this. I've gotten closer each time but still cannot fully connect. I have Iron:Router and can go to any page that doesn't require logging in but once I attempt to register or login it 'freezes' and in the debugging process it says it cannot connect.



in /server/lib/config.js

Meteor.startup(function() {

var theURL = "";

if (process.env.NODE_ENV === "development") {
theURL = "http://101.ipaddress.0.0:3000";

Meteor.absoluteUrl.defaultOptions.rootUrl = theURL;
process.env.ROOT_URL = theURL;
process.env.MOBILE_ROOT_URL = theURL;
process.env.MOBILE_DDP_URL = theURL;


After some tinkering with these, it relayed me to a CORS issue afterwards. Which I resolved by doing

2. CORS and App.access

in mobile-config.js


This then brought me to another error that was associated with iOS security transport which is newer from xcode 8 I believe? I resolved this by

3. Altering App Transport Security Settings

in xCode the info tab: under App Transport Security added "Allow Arbitrary Loads": "true"

enter image description here

Suggested steps

I also found a nice little piece that will console log connection status.

Meteor.autorun(function () {
var stat;
if (Meteor.status().status === "connected") {
stat = 'lime'
}else if (Meteor.status().status === "connecting") {
stat = 'yellow'
}else {
stat = 'red';


This is associated with the register button and every time it's clicked it just fires the status. It's always been 'red'.

Safari debugger says I cannot connect.

Steps taken to connect

meteor run ios-device --mobile-server 101.ipaddress:3000

then I click run button. I have read up on hot code push issues and will commonly delete '.meteor/local/bundler-cache' && 'cordova-build'

I've come to a roadblock and would love some assistance/suggestions on what would be a next fix (or maybe I'm fundamentally skipping something which would be terribly annoying but joyful at the same time).

Extra info

Meteor versions tried 1.2.1 & 1.3

// Server authentication info
"servers": [
"host": "101.ipaddress.0.1",
"username": "username",
//"password": "password",
// or pem file (ssh based authentication)
// WARNING: Keys protected by a passphrase are not supported
"pem": "ssh/directory",
"pem": "ssh/directory",
"env": {}

// Install MongoDB on the server. Does not destroy the local MongoDB on future setups
"setupMongo": true,

// Application name (no spaces).
"appName": "AppName",

// Location of app (local directory). This can reference '~' as the users home directory.
// i.e., "app": "~/Meteor/my-app",
// This is the same as the line below.
"app": "/directory/to/app",

// Configure environment
// ROOT_URL must be set to your correct domain (https or http)
"env": {
"PORT": 80,
"ROOT_URL": "",

// Meteor Up checks if the app comes online just after the deployment.
// Before mup checks that, it will wait for the number of seconds configured below.
"deployCheckWaitTime": 60,

// show a progress bar while uploading.
// Make it false when you deploy using a CI box.
"enableUploadProgressBar": true


I have not been able to replicate the errors on a new build using version 1.2.1.

However what may have been causing some problems:

[ip]:[port] is not how I am actually testing the connection. The most successful way for me to build the app and have it work on devices and emulators was to

meteor build <directory> ios --mobile-server <ipaddress>

Note the absence of [port].

Also when I build for apple I use

meteor run ios-device --mobile-server 101.ipaddress.1

And then click on product>archive

For deployment I'm using mupx mupx deploy

Meteor's deploy/compiling process may be a mess as the first time I attempted to upload the apk it gave me the actual number I had set in mobile-config.js i.e. version 0.0.7 but after that each attempt concatenated an 8 at the end. i.e. if I had 0.0.1 it was 18, and 0.0.2 it was 28. This was even with

App.setPreference('android-versionCode', '7');
App.setPreference('android-targetSdkVersion', '23')

Set. Which is disappointing because it seems like such a fast build for web apps. I was excited to test it on mobile on to come across so many issues.

So in summary. Built a new meteor 1.2 app. Then added manually all of my packages. After that I copy and pasted my client, lib and server folders. I can now register and login and it's showing an active connection using the coding snippet above.