Meteor app on android physical device doesn't work with deployed server


#1

I have created a meteor app which works fine locally. But when I deployed my app to AWS EC2 using mup, I am able to connect from browser but android app in the physical device doesn’t seems to be connected.

Following is the command which I use to deploy app on device:

meteor run android-device --mobile-server http://example.com

I also tried using meteor build command and then installing using .apk in the device, still it doesn’t work.

Note*: App works fine with cloud server when only connected with USB cable.

Anyone know how to fix it or any hack around ?


#2

Did you set ROOT_URL on the server?


#3

Yes. I just found the fix or hack I don’t its correct but its working.

What I did is I set ROOT_URL and commented port, in short I am not using port anywhere.


#4

But I see very slow response from the server. I get response after a minute or two from the server. Could you let me know what are possible reasons for it. I am hosting app on AWS EC2.


#5

Hi,

It might be the memory, check if you have enougth memory


#6

I checked using top command and memory and you usage seems fine. Any other area to look at?


#7

Max memory usage hike I can see is 17.1.


#8

On my side I am using pm2 to run the node instance, on a ec2.micro ( free tier ) avec 4 apps that use around 150 Mb the server begins to be really really slow.

With pm2 list you will have the memory used by each instance.

From a top perspective it begins to try to use swap, and by deault on ec2 there is no swap so the full server begin to be really slow.

I would advise you to try, if you can to deploy the exact same code using meteor 1.2 to see if you have the same behaviour ( slowness) that would rule out meteor 1.3 vs meteor 1.2, as meteor 1.3 is still in beta


#9

Well I am using mup tp deploy so i am not sure whats meteor version is installed on server. Could you please elaborate more on

I would advise you to try, if you can to deploy the exact same code using meteor 1.2 to see if you have the same behaviour ( slowness) that would rule out meteor 1.3 vs meteor 1.2, as meteor 1.3 is still in beta

Locally I am using Meteor 1.2.1.
How to achieve it?


#10

I was wondering do you get slowness response also when you access to the web app from a desktop browser ? if this is the case then it s probably in the code its self

Are you using nginx in front of the meteor server ?


#11

Yes, I get slowness even on desktop browser. If its in code then how come locally everything works fine. Also I tried to run meteor in production mode locally to see if any differences occur but everything works like a charm.


#12

There is something that you can do to make sure it s not in the building process but related to your infrastructure.

You can build locally and then execute it via node:

meteor build --directory [yourpath] --server ROOT_URL the local one the one from your dev env

Once build, you go in [yourpath]/bundle/programs/server

and run node …/…/main.js

it should run your meteor server similarly than what mup is doing on your ec2.

If this is still quick enougth, then this is related either to mup or to your ec2 infrastructure.

I would advice you to add some log inside your code to been able to track down the performance issues that you might have in production.

It might also be related to your mongo db infra on ec2, you need to make sure that you have installed mongodb in the correct way to use oplog : https://meteorhacks.com/mongodb-oplog-and-meteor/


#13

I am trying out whatever you have told above. I get some npm errors. I installed modules those were giving errors but something is weird about fibers npm module. Tried uninstalling/installing fibers modules but its cracking.


#14

Yes fiber can be troublesome, have a look to this stackoverflow answer and the link inside they should put you on the right track : http://stackoverflow.com/questions/13327088/meteor-bundle-fails-because-fibers-node-is-missing


#15

This didn’t work. I still get

Error: Module did not self-register.


#16

what was the command line ?


#17

I am using Node.js version : v5.5.0 & Meteor : 1.2.1 on Mac.

I followed the solution as described in stack overflow post then i installed the NPMs which were required. After I run the command to run main.js I get this error:

/Users/VIDDESH/node_modules/fibers/future.js:280
throw(ex);
^

Error: Module did not self-register.
at Error (native)
at Object.Module._extensions…node (module.js:440:18)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)…


#18

ok I see you need to run npm install first in [yourpath]/bundle/programs/server

and then node …/…/main.js

For node you should use another version as well as the node version for meteor if probably not the 5.5.0

Have a look here to find it out : https://meteorhacks.com/how-meteor-uses-node.html


#19

Hi, I am able to run the bundle locally but m trying to connect it on localhost but i am not able to connect it.


#20

Finally I got it working and following is my observation:

  1. App works fast compared to cloud
  2. I can see some issues similar on cloud, i mean things those work locally fine does not work properly.