gSlack icon indicating copy to clipboard operation
gSlack copied to clipboard

api_token error

Open JoshuaEdwards1991 opened this issue 5 years ago • 2 comments

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?

JoshuaEdwards1991 avatar Feb 28 '20 12:02 JoshuaEdwards1991

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

Dror88 avatar Mar 01 '20 08:03 Dror88

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

JoshuaEdwards1991 avatar Mar 02 '20 14:03 JoshuaEdwards1991