gSlack
gSlack copied to clipboard
api_token error
Yo!
Absolutely love the idea of this project, and dying to get it integrated into my environment.
I am having a little trouble with the firebase install and get this error from the function:
Detailed stack trace: TypeError: Cannot read property 'api_token' of undefined
at Object.<anonymous> (/srv/index.js:9:52)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at getUserFunction (/worker/worker.js:439:24)
at loadUserCode (/worker/worker.js:495:18)
I was wondering if you knew what has gone wrong here? It looks like it can't pick up these values from the firestore database?
Looks like it's related to the function env variables, make sure to follow https://github.com/doitintl/gSlack/blob/c625428c8332ab88a500be8f1eb103b4d2b4e831/README.md#initialize-firebase-environment
You can verify it by running
$ firebase functions:config:get
I had to update this
const web = new WebClient(functions.config().gslack.api_token);
to this
const web = new WebClient(process.env.api_token);
to get rid of the error