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

api_token error #10

Open
JoshuaEdwards1991 opened this issue Feb 28, 2020 · 2 comments
Open

api_token error #10

JoshuaEdwards1991 opened this issue Feb 28, 2020 · 2 comments

Comments

@JoshuaEdwards1991
Copy link

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?

@Dror88
Copy link
Collaborator

Dror88 commented Mar 1, 2020

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

@JoshuaEdwards1991
Copy link
Author

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

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

2 participants