zodern / meteor-up

Production Quality Meteor Deployment to Anywhere
http://meteor-up.com/
MIT License
1.27k stars 281 forks source link

mup status throws errors: Cannot read property 'split' of undefined #1023

Open cpury opened 5 years ago

cpury commented 5 years ago

Mup version (mup --version): 1.4.5

Mup config

{
  "servers": {
    "one": {
      "host": "1.2.3.4",
      "username": "ubuntu",
      "pem": "~/.ssh/pem"
    }
  },
  "app": {
    "name": "my-app",
    "path": "../",
    "servers": {
      "one": {}
    },
    "buildOptions": {
      "serverOnly": true
    },
    "env": {
      "ROOT_URL": "https://subdomain.host.com",
      "MONGO_URL": "...",
      "MONGO_OPLOG_URL": "...",
      "VIRTUAL_HOST": "sub.domain.com",
      "HTTPS_METHOD": "redirect",
      "HTTP_FORWARDED_COUNT": 1,
      "LETSENCRYPT_HOST": "sub.domain.com",
      "LETSENCRYPT_EMAIL": "dev@domain.com"
    },
    "docker": {
      "image": "abernix/meteord:node-8-base",
      "stopAppDuringPrepareBundle": true
    },
    "enableUploadProgressBar": true,
    "type": "meteor"
  },
  "proxy": {
    "domains": "sub.domain.com",
    "ssl": {
      "letsEncryptEmail": "dev@domain.com",
      "forceSSL": true
    }
  }
}

Output of command

=> Servers
  - server.com: Ubuntu 18.04

=> Docker Status
 - server.com: 18.06.1-ce Running

=> Meteor Status
 - server.com: running
    Created at 2018-10-11T09:15:27.206832507Z
    Restarted 0 times
    ENV:
     - ROOT_URL=https://sub.domain.com/
     - MONGO_URL=...
     - MONGO_OPLOG_URL=...
     - VIRTUAL_HOST=sub.domain.com
     - HTTPS_METHOD=redirect
     - HTTP_FORWARDED_COUNT=1
     - LETSENCRYPT_HOST=sub.domain.com
     - LETSENCRYPT_EMAIL=dev@domain.com
     - METEOR_SETTINGS=...
     - PORT=80
     - PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
     - METEORD_DIR=/opt/meteord
     - NODE_VERSION=8.11.3
    Exposed Ports:
     - 80/tcp
    App available through reverse proxy
     - Available in app's docker container: true
TypeError: Cannot read property 'split' of undefined
    at /usr/local/lib/node_modules/mup/lib/plugins/proxy/command-handlers.js:77:66
    at Array.reduce (<anonymous>)
    at Object.parser (/usr/local/lib/node_modules/mup/lib/plugins/proxy/command-handlers.js:75:47)
    at parseCollectorOutput (/usr/local/lib/node_modules/mup/lib/server-info.js:140:27)
    at /usr/local/lib/node_modules/mup/lib/server-info.js:146:25
    at Array.forEach (<anonymous>)
    at createHostResult (/usr/local/lib/node_modules/mup/lib/server-info.js:145:17)
    at /usr/local/lib/node_modules/mup/lib/server-info.js:157:22
    at process._tickCallback (internal/process/next_tick.js:68:7) { host: 'server.com',
  username: 'ubuntu',
  pem: '...' }
(node:69194) UnhandledPromiseRejectionWarning: TypeError: Cannot read property '_host' of undefined
    at /usr/local/lib/node_modules/mup/lib/server-info.js:175:27
    at Array.forEach (<anonymous>)
    at /usr/local/lib/node_modules/mup/lib/server-info.js:174:19
    at tryCatcher (/usr/local/lib/node_modules/mup/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/usr/local/lib/node_modules/mup/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/usr/local/lib/node_modules/mup/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/usr/local/lib/node_modules/mup/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/usr/local/lib/node_modules/mup/node_modules/bluebird/js/release/promise.js:693:18)
    at Promise._fulfill (/usr/local/lib/node_modules/mup/node_modules/bluebird/js/release/promise.js:638:18)
    at MappingPromiseArray.PromiseArray._resolve (/usr/local/lib/node_modules/mup/node_modules/bluebird/js/release/promise_array.js:126:19)
    at MappingPromiseArray._promiseFulfilled (/usr/local/lib/node_modules/mup/node_modules/bluebird/js/release/map.js:101:18)
    at Promise._settlePromise (/usr/local/lib/node_modules/mup/node_modules/bluebird/js/release/promise.js:574:26)
    at Promise._settlePromise0 (/usr/local/lib/node_modules/mup/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/usr/local/lib/node_modules/mup/node_modules/bluebird/js/release/promise.js:693:18)
    at Async._drainQueue (/usr/local/lib/node_modules/mup/node_modules/bluebird/js/release/async.js:133:16)
    at Async._drainQueues (/usr/local/lib/node_modules/mup/node_modules/bluebird/js/release/async.js:143:10)
(node:69194) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:69194) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I checked the code for the mup release 1.4.5 and it suspiciously does not have a .split at plugins/proxy/command-handlers.js:77:66... It does have one in line 56: const domains = config.domains.split(',');, but that would mean that config.proxy.domains would be undefined, which it clearly is not (SSL is working btw).

The other error might be a consequence of the first, but I found the line anyway: https://github.com/zodern/meteor-up/blob/3c7120a75c12ea12fdd5688e33574c12e158fd07/src/server-info.js#L174

Any ideas?

kPanesar commented 5 years ago

I'm getting the exact same errors after enabling SSL. Glad to know I'm not the only one.

eric-burel commented 5 years ago

It's weird. If you add a domains prop to your config outside of proxy, it will work (except that validation of the config will show an error, since domains must be in proxy). So somehow api.getConfig().proxy seems wrong.

rolljee commented 5 years ago

After adding the proxy property, did you ran the :

mup proxy setup --config=mup.js or mup proxy reconfig-shared --config=mup.js

to see if it configure the let's encrypt properly ?