I am having a problem with producing two different apps and installing them each using test flight.
When I install the second app, it pulls from the first app’s server. The first app works fine.
I am specifying a unique server while building for the mobile platforms, but the second app still ends up using the first app’s server when installing using test flight.
When I export the second app using xCode, and install using iTunes directly to my phone, the server doesn’t switch and the second app works perfectly.
Any insight on this bug?
Have you tried this with different apps? Or is it a one time occurrence? It sounds to me caching could be the culprit here. Maybe you’ve built an old version of the second app pointing to the wrong server? I think it is unlikely to be a bug, especially since an Xcode build does work correctly. But please open an issue on GitHub if you do find a way to replicate this behavior.
The two apps are separate in iTunes Connect. If it is a caching issue, how would I solve that? I have uploaded a few different versions all pointed to the correct server, so that isn’t the issue. It has to be a bug with test flight, if it isn’t a caching issue, because when I don’t use test flight, and install it directly on my phone using iTunes, it works fine.
I have tried uninstalling and reinstalling meteor, creating a new meteor project and installing all of the needed packages again. It didn’t solve the issue. Also, I install the android app using test fairy, and it doesn’t switch servers or have any caching issues. The android app works fine.
Have you tried removing the apps from the device and reinstalling them?
Yes I have tried removing the apps and reinstalling them. I tried removing the first app, and only having the second app on my phone, but it still switched servers.
Where are you deploying the server apps? Did you specify --mobile-server or have you defined environment variables to specify how to connect?
The server apps are deployed using mup (Meteor Up) onto an Amazon Web Services EC2 server. But I have also tried to deploy to a free “.meteor.com” subdomain, and it still switched servers.
The “–mobile-server” doesn’t work with the “meteor build” command. How to I specify “–mobile-server”?
I tried doing “meteor --mobile-server=http://xxx.xxx.xxxx” but it just ran the meteor app, and didn’t seem to do anything. Do I have to run the “–mobile-server” command for it to work properly? And how do I do that? Is that my problem?
I’m not sure if this is your problem, but it might be. Let me give you some context.
A mobile client decides where to connect to based on the settings in the generated index.html. These settings take their values based on environment variables that can either be set directly or be controlled with command options.
If you’re using
meteor build, you can specify the server to connect to with the
--server option (this is similar to the
--mobile-server option for
meteor run). This sets the ROOT_URL and DDP_DEFAULT_CONNECTION_URL in the generated index.html.
Because subsequent updates delivered through Hot Code Push replace the initially bundled index.html with a freshly generated one, the server should also be configured with the right connection URL. Otherwise, the client may not be able to connect, or perhaps connect to the wrong server, after a Hot Code Push.
meteor deploy takes care of setting these values automatically, so there is no need to specify anything in that case… But when deploying on your own server, you have to make sure to set at least the ROOT_URL environment variable (DDP_DEFAULT_CONNECTION_URL defaults to the same value). For Meteor Up, you can configure this in
Having said all this, I’m not sure why in your case the first app works correctly, and the second one connects to the first. How are you hosting multiple apps on the same server? Using Nginx vhosts by any chance?
I am simply using different ports on the same server for the two apps. But when I deploy to the free meteor subdomain, it still switches. I use “meteor deploy” to deploy to the free meteor subdomain. If the deploy command sets the ROOT_URL automatically, then that still isn’t working. It switches to the first app’s server after installing with test flight.
I specify the server using “meteor build --server=http://xxx.xxx.xxxx:8000”
Port 8000 is the port I use for the second app. But like I said, I also used deploy to a free meteor subdomain, specified that url in the meteor build command, and it still switched to the first app’s server.
I think I might have a problem. I don’t have an index.html file in the root of my meteor app. Is that where it is supposed to be? Shouldn’t it automatically generate it?
I’ve edited my above reply to not cause more confusion.
meteor deploy sets ROOT_URL automatically while serving the app, but when using
meteor build to build a mobile app, you still need to specify the *.meteor URL for the
So to summarize:
- Are you specifying the right URLs for both apps on
- When not using
meteor deploy, have the server apps been configured with the right ROOT_URL?
The index.html I was talking about is indeed generated automatically.
So I sometimes get a similar problem with Hot Code Reload. My mobile app is linked to the URL where my app is hosted out (set during the build process), and sometimes that app does not get updated, and sometimes it does. I was having a specific problem with the Router (Flow Router). I had a check to see if there was a Meteor.userId() and if so, then to go to the home route, and when there wasn’t, to go to the login route, however no matter what (even after loggin in), the cordova app would go to the login route after I fully closed and opened the app again (while routing worked correctly on the browser).
How do I check to see what ROOT_URL it is using? where is that generated file?
I do specify the correct URL when doing meteor build.
For a deployed app, view source on
http://<domain>/__cordova/index.html to see what configuration variables it sets (look for
That URL just results in a black, blank screen for me.
And does view source show anything? (I’m assuming you’re replacing
<domain> with your own domain…)
I just viewed source and it shows the correct domain for those variables.
Does it also show the right ports? (You mentioned running the two apps on different ports.)
No it doesn’t show the right ports! How do I fix that?
I have my app deployed on two different servers. The AWS EC2 server, which uses port 8000. The other on subdomain.meteor.com.
Subdomain.meteor.com doesn’t work either though. It switches to the first app. The meteor subdomain doesn’t use ports and shows correctly in the variables in index.html, but still switches.
So it doesn’t show the right url on the EC2 server, but does on the meteor deploy. But both don’t work. They both switch.