Deploying a Meteor 1.3 app on Heroku

I’m trying to deploy a not-too-serious app on heroku (since it has a free-tier; otherwise I’d use either Modulus or Galaxy) and have run into an annoying issue. I’ve dug and found mentions here and there about Meteor 1.3 not working with heroku because of the npm shrinkwrap file, but never anything official. I tried removing npm-shrinkwrap.json from my git repository before pushing to heroku, and got the same error. Here are the logs that show up when building or rebuilding the meteor app:

2016-04-16T04:32:03.008941+00:00 heroku[web.1]: Starting process with command `.meteor/heroku_build/bin/node .meteor/heroku_build/app/main.js`
2016-04-16T04:32:07.543429+00:00 app[web.1]: 
2016-04-16T04:32:07.543525+00:00 app[web.1]: /app/.meteor/heroku_build/app/programs/server/node_modules/fibers/future.js:267
2016-04-16T04:32:07.543882+00:00 app[web.1]: 						throw(ex);
2016-04-16T04:32:07.543893+00:00 app[web.1]: 						      ^
2016-04-16T04:32:08.076228+00:00 app[web.1]: Error: MONGO_URL must be set in environment
2016-04-16T04:32:08.076241+00:00 app[web.1]:     at Object.<anonymous> (packages/mongo/remote_collection_driver.js:36:11)
2016-04-16T04:32:08.076242+00:00 app[web.1]:     at Object.defaultRemoteCollectionDriver (packages/underscore.js:784:19)
2016-04-16T04:32:08.076243+00:00 app[web.1]:     at new Mongo.Collection (packages/mongo/collection.js:102:40)
2016-04-16T04:32:08.076243+00:00 app[web.1]:     at AccountsServer.AccountsCommon (packages/accounts-base/accounts_common.js:23:18)
2016-04-16T04:32:08.076244+00:00 app[web.1]:     at new AccountsServer (packages/accounts-base/accounts_server.js:18:5)
2016-04-16T04:32:08.076245+00:00 app[web.1]:     at meteorInstall.node_modules.meteor.accounts-base.server_main.js (packages/accounts-base/server_main.js:9:12)
2016-04-16T04:32:08.076246+00:00 app[web.1]:     at fileEvaluate (packages/modules-runtime.js:158:9)
2016-04-16T04:32:08.076246+00:00 app[web.1]:     at require (packages/modules-runtime.js:92:16)
2016-04-16T04:32:08.076247+00:00 app[web.1]:     at /app/.meteor/heroku_build/app/programs/server/packages/accounts-base.js:1889:15
2016-04-16T04:32:08.076248+00:00 app[web.1]:     at /app/.meteor/heroku_build/app/programs/server/packages/accounts-base.js:1900:3
2016-04-16T04:32:09.117047+00:00 heroku[web.1]: State changed from starting to crashed
2016-04-16T04:32:09.121064+00:00 heroku[web.1]: Process exited with status 8
2016-04-16T04:32:11.038541+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=awesome-signature.herokuapp.com request_id=fc333020-accc-4ed2-9dec-37ffad85671f fwd="198.7.220.68" dyno= connect= service= status=503 bytes=
2016-04-16T04:32:11.624785+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=awesome-signature.herokuapp.com request_id=9ca55335-c32c-4371-b873-4f0cb24ca214 fwd="198.7.220.68" dyno= connect= service= status=503 bytes=

I followed this tutorial for deploying my Meteor app (I have a 1.2 app already running without a hitch using it), which included a step to add the mLab addon to the heroku project, and typing heroku config on my terminal reveals the Mongo URL that’s been set. So I’m pretty confused as to why it would throw the error MONGO_URL must be set in environment. Does anyone know how to solve this?

Try http://stackoverflow.com/questions/13327088/meteor-bundle-fails-because-fibers-node-is-missing

Meteor does not support Node versions > 0.10.40 (https://github.com/meteor/meteor/issues/5124). The recommended version is 0.10.36. I’d suggest you to uninstall your current Node version on the server, install the recommended version and retry.

Just a quick update: it turns out I wasn’t paying close enough attention to my environment variables, and that the error I was getting was totally accurate. Adding mLab from the command line toolbelt generated an ENV variable called MONGODB_URI, not either MONGO_URL or MONGOLAB_URI (both of which do in fact work if you’re using mLab). Switching that env var solved my problem, and the app got pushed just fine to heroku. Adding back the npm-shrinkwrap.json file worked as well.

Before I realized the actual error, however, I thought the issue might have to do with the Horse buildpack. I tried changing from the horse buildpack to the officially-recognized buildpack. @hgadgil, I think your source is a bit outdated. The official buildpack hasn’t been updated in a year or so and used node (0.10.40), which threw me errors in the Heroku logs that node was out of date. So I bumped the part of it that specified the node version to 0.10.41 and re-pushed to heroku using the new buildpack (lots of PRs are open on it to bump the node version, but the repo looks abandoned). After the MONGO_URL change above, this solution seems to work equally well.

1 Like

UPDATE: horse buildpack works with Meteor v1.4 (Node 4) as well.

1 Like