Search code examples
node.jsmeteorheroku

METEOR_SETTINGS is not valid json error when deploying meteor app to heroku


As the title says, I am getting that error when deploying my meteor app to heroku. I have already validated my settings.json file with JSONlint and have searched for any possible fix but I have not come across any which work. My error logs are as shown below. Could anyone tell me what might be wrong?

2017-09-03T11:18:31.226632+00:00 heroku[web.1]: Starting process with command `.meteor/heroku_build/bin/node $NODEJS_PARAMS .meteor/heroku_build/app/main.js`
2017-09-03T11:18:33.344368+00:00 app[web.1]: /app/.meteor/heroku_build/app/programs/server/boot.js:391
2017-09-03T11:18:33.344382+00:00 app[web.1]: }).run();
2017-09-03T11:18:33.344383+00:00 app[web.1]:    ^
2017-09-03T11:18:33.344384+00:00 app[web.1]: 
2017-09-03T11:18:33.344385+00:00 app[web.1]: Error: METEOR_SETTINGS are not valid JSON: $(cat settings.json)
2017-09-03T11:18:33.344385+00:00 app[web.1]:     at packages/meteor.js:59:11
2017-09-03T11:18:33.344386+00:00 app[web.1]:     at packages/meteor.js:80:4
2017-09-03T11:18:33.344387+00:00 app[web.1]:     at packages/meteor.js:1380:3
2017-09-03T11:18:33.344388+00:00 app[web.1]:     at /app/.meteor/heroku_build/app/programs/server/boot.js:338:34
2017-09-03T11:18:33.344388+00:00 app[web.1]:     at Array.forEach (native)
2017-09-03T11:18:33.344389+00:00 app[web.1]:     at Function._.each._.forEach (/app/.meteor/heroku_build/app/programs/server/node_modules/underscore/underscore.js:79:11)
2017-09-03T11:18:33.344390+00:00 app[web.1]:     at /app/.meteor/heroku_build/app/programs/server/boot.js:158:5
2017-09-03T11:18:33.344391+00:00 app[web.1]:     at /app/.meteor/heroku_build/app/programs/server/boot.js:387:5
2017-09-03T11:18:33.344392+00:00 app[web.1]:     at Function.run (/app/.meteor/heroku_build/app/programs/server/profile.js:510:12)
2017-09-03T11:18:33.344392+00:00 app[web.1]:     at /app/.meteor/heroku_build/app/programs/server/boot.js:386:11
2017-09-03T11:18:33.415049+00:00 heroku[web.1]: State changed from starting to crashed
2017-09-03T11:18:33.400865+00:00 heroku[web.1]: Process exited with status 1

Solution

  • Your problem is with this command:

    heroku config:add METEOR_SETTINGS="$(cat settings.json)"
    

    You see, on Windows, the $(cat settings.json) means just text, but on Mac/*nix that means "get content of settings.json file".

    I'd recommend to use git bash cli to run this command there. Link to Git for Windows (with git bash cli): https://git-for-windows.github.io/