backspace / slack-statsbot

A Slack bot to track statistics about who is talking the most
80 stars 12 forks source link

Can't deploy locally #14

Closed maxgaudin closed 8 years ago

maxgaudin commented 8 years ago

I'm trying to deploy via Cloud 9 and get the following error after running 'npm start':

Thoughts?

> slack-statsbot@0.1.0 start /home/ubuntu/workspace/secret-gorge-4061
> node --use-strict index.js

/home/ubuntu/workspace/secret-gorge-4061/node_modules/convict/lib/convict.js:399
        throw new Error(errBuf);
        ^

    at Object.rv.validate (/home/ubuntu/workspace/secret-gorge-4061/node_modules/convict/lib/convict.js:399:15)
    at Object.<anonymous> (/home/ubuntu/workspace/secret-gorge-4061/config.js:59:6)
    at Module._compile (module.js:434:26)
    at Object.Module._extensions..js (module.js:452:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Module._compile (module.js:434:26)

npm ERR! Linux 4.2.0-c9
npm ERR! argv "/home/ubuntu/.nvm/versions/node/v4.1.1/bin/node" "/home/ubuntu/.nvm/versions/node/v4.1.1/bin/npm" "start"
npm ERR! npm  v2.14.4
npm ERR! code ELIFECYCLE
npm ERR! slack-statsbot@0.1.0 start: `node --use-strict index.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the slack-statsbot@0.1.0 start script 'node --use-strict index.js'.
npm ERR! This is most likely a problem with the slack-statsbot package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! There is likely additional logging output above.
backspace commented 8 years ago

Hmm, well I use convict to validate the presence of environment variables. I would expect a more helpful error message than that when validation fails! You could look at config.js to see what variables and values are expected, maybe you’re missing one, like the SLACK_TOKEN?

I will look into getting a more useful error message out of convict. Thanks for letting me know about this problem.

maxgaudin commented 8 years ago

Actually it was throwing a error at some point with something like "expecing a string for SlackToken". I entered the token according to the README like so: SLACK_TOKEN=your_token

backspace commented 8 years ago

Okay, the only other required one without a default is DATABASE_URL, do you have that?

maxgaudin commented 8 years ago

Yes I gave it the DB URL as well. I had originally tried to deploy on Heroku but Heroku was not having any of that :)

backspace commented 8 years ago

Hmm! I have it deployed to Heroku and running. But the Deploy to Heroku button is probably broken.

It does seem like an environment variable thing. I tried running it without SLACK_TOKEN and got this error:

/Users/b/Documents/Code/slack-statsbot/node_modules/convict/lib/convict.js:399
        throw new Error(errBuf);
        ^

Error: slackToken: must be of type String
    at Object.rv.validate (/Users/b/Documents/Code/slack-statsbot/node_modules/convict/lib/convict.js:399:15)
…

So it’s weird that your error message doesn’t say what the missing configuration variable is. Have you changed any of the other files? The configuration delegates to app.json to get some of the variables out of the Heroku deployment.

backspace commented 8 years ago

I’m still into helping get this working if you like @maxgaudin, but in the absence of a response I’m going to close this issue!