Skip to content
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_SETTINGS JSON parsing issues #55

Closed
dinkzilla opened this issue May 17, 2017 · 14 comments
Closed

METEOR_SETTINGS JSON parsing issues #55

dinkzilla opened this issue May 17, 2017 · 14 comments

Comments

@dinkzilla
Copy link

After 'Container Started' but before 'Deployment Complete!' I get the following error:

/bundle/programs/server/boot.js:356
}).run();
^
Error: METEOR_SETTINGS are not valid JSON: '{"TWILIO":{"FROM":"+18NUMBER50","SID":"AC71NUMBERS7d","TOKEN":"bc0TOKENfc0c"},"WEBADDRESS":"http://web.site/"}'
at packages/meteor.js:59:11
at packages/meteor.js:80:4
at packages/meteor.js:1380:3
at /bundle/programs/server/boot.js:303:34
at Array.forEach (native)
at Function..each..forEach (/bundle/programs/server/node_modules/underscore/underscore.js:79:11)
at /bundle/programs/server/boot.js:128:5
at /bundle/programs/server/boot.js:352:5
at Function.run (/bundle/programs/server/profile.js:510:12)
at /bundle/programs/server/boot.js:351:11

I've edited the json above to hide my data, but you can see what it is and it is in fact valid. The site runs fine locally without errors.

I've thrown it into json validators several times to make sure I wasn't missing anything. I even typed everything manually into a new file to make sure copying didn't accidentally snag some weird character. No dice so far. Any ideas on what I can check?

@jamiebones
Copy link

I am having the same issue. I was about to open this particular issue before i saw this issue open. I have also validated my JSON and it works locally. Don't know why it refused to work. Any help from anyone will be appreciated.

@jkrup
Copy link
Owner

jkrup commented May 17, 2017

How are you setting METEOR_SETTINGS? Are you using a development.settings.json / production.settings.json, or typing it in manually in the command prompt. I have noticed that some terminals act weird with " and ' characters so if you are typing it in manually you may want to try having a x.settings.json file.

@dinkzilla
Copy link
Author

I am using x.settings.json. I also tried directly specifying the file path (instead of allowing node_env to get it by default) but both failed. I have not tried directly typing it, and do not have access to that machine at the moment. I will try that later to see if it works.

@purplecones
Copy link
Collaborator

I was able to deploy https://meteor-test-hxhiznyapg.now.sh/ using the settings file JSON you posted above and it deployed with no issues.

 /V/H/P/O/m/meteor-test meteor-now -e NODE_ENV=development -d                                                                                                                                  130
[METEOR-NOW] - running command: meteor build .meteor/local/builds --server-only --architecture=os.linux.x86_64
                                              
WARNING: The output directory is under your source tree.
         Your generated files may get interpreted as source code!
         Consider building into a different directory instead
         meteor build ../output
                                              
[METEOR-NOW] - creating Dockerfile            
[METEOR-NOW] - creating supervisor
[METEOR-NOW] - splitting bundle
[METEOR-NOW] - looking for meteor settings file development.settings.json in root of project
[METEOR-NOW] - found settings file
WARNING: Did not pass a MONGO_URL. Bundling a NON-PRODUCTION version of MongoDB with your application. Read about the limitations here: https://git.io/vM72E
[METEOR-NOW] - running command: cd .meteor/local/builds && now -e PORT=3000 -e MONGO_URL=mongodb://127.0.0.1:27017 -e ROOT_URL=http://localhost.com -e NODE_ENV=development -d -e METEOR_SETTINGS='{"TWILIO":{"FROM":"+18NUMBER50","SID":"AC71NUMBERS7d","TOKEN":"bc0TOKENfc0c"},"WEBADDRESS":"http://web.site/"}'
> Deploying /Volumes/HDD/Projects/OSS/meteor-test-apps/meteor-test/.meteor/local/builds under purplecones
> [debug] Detected `deploymentType` = `docker`
> [debug] Detected `deploymentName` = ""meteor-test""
> [debug] locating files /Volumes/HDD/Projects/OSS/meteor-test-apps/meteor-test/.meteor/local/builds: 5.504ms
> [debug] Getting files: 9.794ms
> [debug] Computing hashes: 70.387ms
> [debug] /now/create: 1500.998ms
> Ready! https://meteor-test-hxhiznyapg.now.sh (copied to clipboard) [2s]

Can you deploy using the -d flag and see that the settings are set correctly. This line above sets the settings:

[METEOR-NOW] - running command: cd .meteor/local/builds && now -e PORT=3000 -e MONGO_URL=mongodb://127.0.0.1:27017 -e ROOT_URL=http://localhost.com -e NODE_ENV=development -d -e METEOR_SETTINGS='{"TWILIO":{"FROM":"+18NUMBER50","SID":"AC71NUMBERS7d","TOKEN":"bc0TOKENfc0c"},"WEBADDRESS":"http://web.site/"}'

@dinkzilla
Copy link
Author

interestingly, today I was originally getting a different error. I had to remove all spaces from the file in order to get it to run (altho this was not an issue last night, and I dno't believe I'd changed anything).

At any rate, I had it with the debug flag and did indeed get the correct METEOR_SETTINGS= output, where everything looks fine, although the error at the end is the same.

Also, I tried typing the settings directly into the command line. In this case, the output command that the debugger is running has all of the double quotes stripped out of it. This ends in the same 'invalid json' result, altho I would expect that in this case.

Still confused, but appreciate the quick responses a lot.

@jkrup jkrup closed this as completed Aug 31, 2017
@dinkzilla
Copy link
Author

Why was this closed?

@jkrup
Copy link
Owner

jkrup commented Sep 17, 2017

I was quickly going through the issues and had thought you were able to get the deploy working.

But now reading over this more carefully it seems you were only able to get it working when you removed all whitespace from the settings.json file? Is that correct?

Could you reproduce the error and then post the x.settings.json file that produces the error (replace real secrets with "XXXXXX" but keep any/all punctuation or special characters).

@jkrup jkrup reopened this Sep 17, 2017
@lmachens
Copy link
Contributor

lmachens commented Feb 17, 2018

Same error here. Even with empty settings:

Error: METEOR_SETTINGS are not valid JSON: '{}'
    at packages/meteor.js:57:11
    at packages/meteor.js:78:4
    at packages/meteor.js:1440:3
    at /usr/src/app/bundle/programs/server/boot.js:411:36
    at Array.forEach (<anonymous>)
    at /usr/src/app/bundle/programs/server/boot.js:220:19
    at /usr/src/app/bundle/programs/server/boot.js:471:5
    at Function.run (/usr/src/app/bundle/programs/server/profile.js:510:12)
    at /usr/src/app/bundle/programs/server/boot.js:470:11

production.settings.json:

{}

Called with meteor-now -e NODE_ENV=production -d:

meteor-now -e NODE_ENV=production -d
i [METEOR-NOW] - clearing build folder
i [METEOR-NOW] - Building meteor app (this can take several minutes)
i [METEOR-NOW] - $ meteor build C:\Users\Admin/.meteor-now/build --server-only --architecture=os.linux.x86_64
i [METEOR-NOW] - Preparing build
‼ [METEOR-NOW] - WARNING: Did not pass a MONGO_URL. Bundling a NON-PRODUCTION version of MongoDB with your application. Read about the limitations here: https://git.io/vM72E
‼ [METEOR-NOW] - WARNING: It might take a few minutes for the app to connect to the bundled MongoDB instance after the deployment has completed.
i [METEOR-NOW] - creating supervisord.conf
i [METEOR-NOW] - splitting bundle
i [METEOR-NOW] - Deploying build (this can take several minutes)
args are  { _:
   [ 'C:\\Program Files\\nodejs\\node.exe',
     'C:\\Users\\Admin\\AppData\\Roaming\\npm\\node_modules\\meteor-now\\build\\main.js' ],
  help: false,
  version: false,
  e: 'NODE_ENV=production',
  d: true,
  '$0': 'C:\\Users\\Admin\\AppData\\Roaming\\npm\\node_modules\\meteor-now\\build\\main.js' }
i [METEOR-NOW] - $ now C:\Users\Admin/.meteor-now/build --name app -e PORT=3000 -e ROOT_URL=http://localhost:3000 -e MONGO_URL=mongodb://127.0.0.1:27017 -e NODE_ENV=production -e METEOR_SETTINGS='{}' -d
> Deploying ~\.meteor-now\build under info@loltrophyhunter.com
> [debug] Detected `deploymentType` = `docker`
> [debug] locating files C:\Users\Admin\.meteor-now\build: 4.042ms
> [debug] Getting files: 6.308ms
> [debug] Computing hashes: 194.281ms
> [debug] get files ready for deployment: 2.494ms
> [debug] v2/now/deployments: 1634.075ms
> [debug] total files 41, 39 changed.
> [debug] Will upload 39 files
> [debug] v2/now/files #1 C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part37: 7325.850ms
> [debug] Uploaded: C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part37 (976.56KB)
> Upload [=-------------------] 3% 0.7s (36.94MB) [39 files]> [debug] v2/now/files #1 C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part02: 7678.959ms
> [debug] Uploaded: C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part02 (976.56KB)
> Upload [=-------------------] 5% 6.8s (36.94MB) [39 files]> [debug] v2/now/files #1 C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part10: 8050.584ms
> [debug] Uploaded: C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part10 (976.56KB)
> Upload [==------------------] 8% 8.8s (36.94MB) [39 files]> [debug] v2/now/files #1 C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part09: 8896.646ms
> [debug] Uploaded: C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part09 (976.56KB)
> Upload [==------------------] 10% 13.8s (36.94MB) [39 files]> [debug] v2/now/files #1 C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part15: 9126.178ms
> [debug] Uploaded: C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part15 (976.56KB)
> Upload [===-----------------] 13% 12.3s (36.94MB) [39 files]> [debug] v2/now/files #1 C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part05: 9177.111ms
> [debug] Uploaded: C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part05 (976.56KB)
> Upload [===-----------------] 15% 10.2s (36.94MB) [39 files]> [debug] v2/now/files #1 C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part20: 9352.295ms
> [debug] Uploaded: C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part20 (976.56KB)
> Upload [====----------------] 18% 9.3s (36.94MB) [39 files]> [debug] v2/now/files #1 C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part33: 9421.177ms
> [debug] Uploaded: C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part33 (976.56KB)
> Upload [====----------------] 21% 8.1s (36.94MB) [39 files]> [debug] v2/now/files #1 C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part07: 13262.883ms
> [debug] Uploaded: C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part07 (976.56KB)
> Upload [=====---------------] 23% 19.7s (36.94MB) [39 files]> [debug] v2/now/files #1 C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part26: 14311.254ms
> [debug] Uploaded: C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part26 (976.56KB)
> Upload [=====---------------] 26% 20.1s (36.94MB) [39 files]> [debug] v2/now/files #1 C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part31: 14969.097ms
> [debug] Uploaded: C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part31 (976.56KB)
> [debug] v2/now/files #1 C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part19: 14971.066ms
> [debug] Uploaded: C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part19 (976.56KB)
> Upload [======--------------] 31% 17.1s (36.94MB) [39 files]> [debug] v2/now/files #1 C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part14: 15503.260ms
> [debug] Uploaded: C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part14 (976.56KB)
> Upload [=======-------------] 34% 16.2s (36.94MB) [39 files]> [debug] v2/now/files #1 C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part30: 15523.304ms
> [debug] Uploaded: C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part30 (976.56KB)
> Upload [=======-------------] 36% 14.5s (36.94MB) [39 files]> [debug] v2/now/files #1 C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part03: 16698.390ms
> [debug] Uploaded: C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part03 (976.56KB)
> Upload [========------------] 39% 14.9s (36.94MB) [39 files]> [debug] v2/now/files #1 C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part21: 17470.854ms
> [debug] Uploaded: C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part21 (976.56KB)
> Upload [========------------] 41% 14.4s (36.94MB) [39 files]> [debug] v2/now/files #1 C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part11: 19579.036ms
> [debug] Uploaded: C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part11 (976.56KB)
> Upload [=========-----------] 44% 15.7s (36.94MB) [39 files]> [debug] v2/now/files #1 C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part28: 19633.650ms
> [debug] Uploaded: C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part28 (976.56KB)
> Upload [=========-----------] 46% 14.2s (36.94MB) [39 files]> [debug] v2/now/files #1 C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part35: 20633.473ms
> [debug] Uploaded: C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part35 (976.56KB)
> Upload [==========----------] 49% 13.8s (36.94MB) [39 files]> [debug] v2/now/files #1 C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part25: 21074.349ms
> [debug] Uploaded: C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part25 (976.56KB)
> Upload [==========----------] 52% 12.9s (36.94MB) [39 files]> [debug] v2/now/files #1 C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part18: 21982.536ms
> [debug] Uploaded: C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part18 (976.56KB)
> Upload [===========---------] 54% 12.4s (36.94MB) [39 files]> [debug] v2/now/files #1 C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part39: 23265.556ms
> [debug] Uploaded: C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part39 (717.75KB)
> Upload [===========---------] 56% 12.5s (36.94MB) [39 files]> [debug] v2/now/files #1 C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part01: 23785.213ms
> [debug] Uploaded: C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part01 (976.56KB)
> Upload [============--------] 59% 11.6s (36.94MB) [39 files]> [debug] v2/now/files #1 C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part24: 25413.136ms
> [debug] Uploaded: C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part24 (976.56KB)
> Upload [============--------] 61% 11.4s (36.94MB) [39 files]> [debug] v2/now/files #1 C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part36: 25797.063ms
> [debug] Uploaded: C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part36 (976.56KB)
> Upload [=============-------] 64% 10.5s (36.94MB) [39 files]> [debug] v2/now/files #1 C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part27: 26388.253ms
> [debug] Uploaded: C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part27 (976.56KB)
> Upload [=============-------] 66% 9.6s (36.94MB) [39 files]> [debug] v2/now/files #1 C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part34: 27014.290ms
> [debug] Uploaded: C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part34 (976.56KB)
> Upload [==============------] 69% 8.8s (36.94MB) [39 files]> [debug] v2/now/files #1 C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part22: 27865.023ms
> [debug] Uploaded: C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part22 (976.56KB)
> Upload [==============------] 72% 8.2s (36.94MB) [39 files]> [debug] v2/now/files #1 C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part06: 29681.981ms
> [debug] Uploaded: C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part06 (976.56KB)
> Upload [===============-----] 74% 7.8s (36.94MB) [39 files]> [debug] v2/now/files #1 C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part16: 29897.236ms
> [debug] Uploaded: C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part16 (976.56KB)
> Upload [===============-----] 77% 6.8s (36.94MB) [39 files]> [debug] v2/now/files #1 C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part17: 30485.550ms
> [debug] Uploaded: C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part17 (976.56KB)
> Upload [================----] 79% 6.0s (36.94MB) [39 files]> [debug] v2/now/files #1 C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part32: 30921.423ms
> [debug] Uploaded: C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part32 (976.56KB)
> Upload [================----] 82% 5.2s (36.94MB) [39 files]> [debug] v2/now/files #1 C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part08: 31544.191ms
> [debug] Uploaded: C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part08 (976.56KB)
> Upload [=================---] 85% 4.4s (36.94MB) [39 files]> [debug] v2/now/files #1 C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part29: 33634.124ms
> [debug] Uploaded: C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part29 (976.56KB)
> Upload [=================---] 87% 3.9s (36.94MB) [39 files]> [debug] v2/now/files #1 C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part12: 34522.662ms
> [debug] Uploaded: C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part12 (976.56KB)
> Upload [==================--] 90% 3.1s (36.94MB) [39 files]> [debug] v2/now/files #1 C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part38: 34566.800ms
> [debug] Uploaded: C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part38 (976.56KB)
> Upload [==================--] 92% 2.3s (36.94MB) [39 files]> [debug] v2/now/files #1 C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part04: 34789.774ms
> [debug] Uploaded: C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part04 (976.56KB)
> Upload [===================-] 95% 1.5s (36.94MB) [39 files]> [debug] v2/now/files #1 C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part13: 34940.876ms
> [debug] Uploaded: C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part13 (976.56KB)
> Upload [===================-] 97% 0.7s (36.94MB) [39 files]> [debug] v2/now/files #1 C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part23: 35873.632ms
> [debug] Uploaded: C:\Users\Admin\.meteor-now\build\app.tar.gz.sf-part23 (976.56KB)
> [debug] Uploading files: 35877.285ms
> [debug] locating files C:\Users\Admin\.meteor-now\build: 2.114ms
> [debug] Getting files: 3.390ms
> [debug] Computing hashes: 120.369ms
> [debug] get files ready for deployment: 2.927ms
> [debug] v2/now/deployments: 3097.957ms
> Ready! https://app-.......now.sh [41s]
> Synced 39 files (36.94MB) [0ms]
> Initializing…
> Building
> ▲ docker build

Maybe it is a Windows issue?

Update
Same configuration works on Ubuntu. So I guess it is related to the additional single quotes surrounding the METEOR_SETTINGS.

@lmachens
Copy link
Contributor

This is still an issue on Windows.
I couldn't manage to read from production.settings.json at all.
I tried to escape special chars of meteorSettings and use different combinations of quotes in:

options.push(['-e', `METEOR_SETTINGS='${meteorSettings}'`]);

But nothing helped. Can someone else give it a try?

Just create a production.settings.json with this content:

{
  "private": {},
  "public": {}
}

And call deployment with -e NODE_ENV=production on Windows.

@CaptainN
Copy link

There appears to be a similar problem in now-cli on Windows. I tried to work around a problem getting my settings to load by using now secret but it wouldn't take. After reading the comment above, I thought I'd try it with removing all whitespace from my settings.json file (even though I had quoted it as the command line tool told me) - and it works when whitespace is removed.

@CaptainN
Copy link

Getting rid of all the whitespace in the settings.json file also allowed it to deploy correctly using the non-secrets method too.

The process of building stalls a lot on Windows. If I listen to my laptop fans spin up and down, and watch the little spinner thing in the terminal, I can tell when it stalls, and press ctrl+c to kick it forward (if I misjudge it, it quits and I have to start all over). I'm not sure what's happening, maybe it's waiting for something to start, or misinterpreting an exit code, or maybe it's just waiting for something to timeout.

@CaptainN
Copy link

CaptainN commented Oct 10, 2018


Scratch that - doing it this way got me a URL (which I assumed meant it worked) but then later I still got the invalid settings message. I guess I'll have to get my mac fixed...

@CaptainN
Copy link

Nothing I did could get this to work on vanilla Windows, but I was able to eventually get it to deploy using Windows Subsystem for Linux (after jumping through some hoops). I can't actually get meteor to run (due to the mongo locking issues) but it doesn't have to to be able to build and deploy with this tool. So there's a workaround if anyone needs it.

It does that weird stall thing in Ubuntu (on WSL) too, but it's more obvious - basically the little spinner wheel (if you are using -d) stops moving and the cursor on the left starts to blink. Hitting Enter gets it to continue on.

@jkrup
Copy link
Owner

jkrup commented Oct 18, 2019

Deprecating in favor of meteor-hero.

@jkrup jkrup closed this as completed Oct 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants