-
Notifications
You must be signed in to change notification settings - Fork 5.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Meteor Cordova app still tries to connect to local server after a build with --server option. #7849
Comments
I realize the docs don't make this 100% clear, but make sure that your Also...
This command will simply generate a bundle directory of a Node app; this is not a "Run command". Additionally, the |
@abernix Note that the doc is also different form the command line help. I will double check the protocol. |
Either should work, but its been suggested that there is a bug with that logic: #7112. (Though, the reproduction steps did not work for me last I tried). Please do report over there if you experience the same behavior. |
EDIT: corrected my first post bout run/build. I did not write the port in ROOT_URL. I will see if it fixes. |
Please also make sure you're starting the $ (cd programs/server && npm install)
$ export MONGO_URL='mongodb://user:password@host:port/databasename'
$ export ROOT_URL='http://example.com' # <===== You can also add :PORT here if necessary.
$ export MAIL_URL='smtp://user:password@mailhost:port/'
$ node main.js |
I am pretty sure the issue does not come from the server.
http://192.168.1.54 is the local dev server address (which I stopped). |
Whaou, I don't understand anything ! I have a lot of warnings, but no fatal error preventing the build. EDIT: ok, no, I am just tired after waiting all the day to find what is going wrong and I made a typo in the command path. |
OK, I have a workaround and repro steps. Repro
It is like meteor build keep the previous url (so the local one) workaround
|
I have had a similar problem when building, sometimes it connects correctly but sometimes it just connects to localhost. The only thing i do solve this is run build again, with the same command and it just works the 2nd or 3rd time. I havent figured out how to reproduce it with a new project. |
gentle ping @abernix @martijnwalraven |
We had the same issue and it was repeatable. You need to do a reset every time you make a serious change before recompiling for mobile (e.g. of a serious change, switching from dev to production, switching between localhost and server). Secondly, almost always, after a reset, the first build fails, but second onwards work. |
This fixes a regression caused by 88d43a0 which is demonstrated in meteor#7849. Essentially, with the current implementation some Cordova build elements are "stale" when the build is copied. For example, if you execute a `meteor run ios` and then `meteor build . --server=http://example.com/` (note: `example.com`) the `config.xml` (`<access origin />`), the boilerplate HTML (`__meteor_runtime_config__`) and other elements of the bundle (`Info.plist` on iOS) will still contain the previously used `http://<local_ip>:3000` address instead of `http://example.com` as they should. Additionally, it would appear that it's impossible to actually checkout a project and immediately run `meteor build` without running `meteor run (android|ios)` first. Various work-arounds for this seem to exist, such as running `meteor build` twice, or running `meteor run --server=http://production.com` first. Ultimately, this is occurring because the bundle is being copied before the Cordova `prepareForPlatform` occurs which I believe was not intended. There is already a test in place which fails without this fix, but marked as `slow` and therefore not executed on CircleCI. Specifically, `cordova builds with server options` would have caught this. Forcibly running this test locally now passes with this change. Fixes meteor#7849 Fixes meteor#7291 Fixes meteor#6756
@dagatsoin Thanks very much for the reproduction. I found the cause of this and opened the above PR. @ramezrafla I believe this is precisely the cause of that problem so please keep your eye on that PR and see if it solves the problem for you! |
Got the same problem here with latest version 1.4.x, spent last two month developing and testing , spent last week searching for possible solutions, still no luck , meteor can get really annoying(unstable) at times. |
@mackbrowne If you provide explicit, step-by-step instructions from a fresh project, I'd be willing to try making another attempt at reproducing this, but as you can see I was already able to reproduce the problem and resolve it to the best of my knowledge. You haven't included information on your testing conditions/environment either. |
@abernix I'm investigating the certificate right now. I tested a few different URLS and only the ones with HTTPS weren't working. Thanks for the reply, but for now I think my issue is unrelated. Sorry about that! |
This is still an issue. I'll try the workaround. Has caused me a great deal of annoyance... please fix! :) |
So I've been using my Mac as the 'be all build all', but I think Mac secretly hates android stuff. Because it compiles PERFECT on my windows pc. So I guess Windows builds android, and mac to mac... Exact same code. So it MUST be a build cache. Perhaps ill build a brand new meteor project, reimport code, and try again. |
I just kept resetting and rebuilding the project up until it eventually worked on like the 14th go. |
meteor build app/ --directory --server-only --server 0.0.0.0:8080
(Xpost with an SO question, but I suspect an issue)
I build my meteor cordova app with
meteor build ../output --server myserverprod.com:8080
Then I upload the android-armv7-debug.apk to an FTP and redownload it on my devices.
But when I remote debugging I see that it still tries to connect to my local server 192.x.x.x instead of the URL I put in the command line.
I also tested by disable wifi to be sure that it happens with the initial embedded files.
Is there any environment variable to set which are not documented?
The text was updated successfully, but these errors were encountered: