Serverless-chatbot woes (slack api error)

aws

#1

Hey guys,

I’m taking an acloud.guru course on the serverless framework. I left a message on the portion I’m having trouble with, but thought i’d stop being so shy and ask for help in other places! Let me know if this wasn’t appropriate.

For those who might be familiar with the course - ://acloud.guru/course/serverless-chatbot/dashboard - The part i’m getting stuck on is the first installation function, which generates a generic slack API error (please let me know if the information provided is sensitive, I don’t believe it is)…

I go to create a slack button > add the slack button > selecting forex > checkmarking bot and unchecking everthing else > clicking add to slack my error.html page appears…

checking the error logs, I see the following…

START RequestId: 1742f3fb-980d-11e7-88e2-55c87ca16c93 Version: $LATEST

2017-09-12 15:52:45.388 (-07:00) 1742f3fb-980d-11e7-88e2-55c87ca16c93 Requesting token with 239594296340.239650116689.8104c5b5d591bbb8bfd30b909526fa7a67435188a817fd629a1332b3d7294d5d

2017-09-12 15:52:45.389 (-07:00) 1742f3fb-980d-11e7-88e2-55c87ca16c93 Fetching ://slack.com/api/oauth.access?clientid=239594296340.240813514535&clientsecret=&code=239594296340.239650116689.8104c5b5d591bbb8bfd30b909526fa7a67435188a817fd629a1332b3d7294d5d

2017-09-12 15:52:45.566 (-07:00) 1742f3fb-980d-11e7-88e2-55c87ca16c93 [Error: SlackAPIError]

END RequestId: 1742f3fb-980d-11e7-88e2-55c87ca16c93

REPORT RequestId: 1742f3fb-980d-11e7-88e2-55c87ca16c93 Duration: 182.48 ms Billed Duration: 200 ms Memory Size: 1024 MBMax Memory Used: 22 MB

The client ID is correct, I have no idea what’s going on with the secret code, but it contains part of the client ID…

I found a way to get a tad more by taking the http url and entering into my browser.

The original error shared in my post was generating the following json…

[{"ok":false,"error":"invalid_client_id"}](https://slack.com/api/oauth.access?clientid=239594296340.240813514535&clientsecret=&code=239594296340.239650116689.8104c5b5d591bbb8bfd30b909526fa7a67435188a817fd629a1332b3d7294d5d ) 

I’ve seem to made it past that, and now the error generates the following json error…

[{"ok":false,"error":"bad_client_secret"}](https://slack.com/api/oauth.access?client_id=239594296340.240813514535&client_secret=&code=239594296340.241143299862.28155ee9eb9fc96434ac4fec06993c6cd596330219563797a6f61a476ce801c0) 

I tried regenerating anew secret key, updating server.yml, and redeploying, but to no avail. Still get the same non descriptive API error.

I realize this is probably more of a slack issue, but since the topic of these forums regard serverless apps I wanted to know if anyone has any insight on how I could troubleshoot this further? If more details are needed, I can provide those as well!

Cyrus

I’m quite stumped here, any ideas?


#2

note - I removed the (https) from two of the urls since new posers aren’t allowed to share more than tow links.


#3

little more information…

When I try the install feature using the “slack button” at https://api.slack.com/docs/slack-button, I get the following error (made the error a little more descriptive so I know where it comes from). Note - it properly redirects me to the error.html…

2017-09-13 08:04:21.329 (-07:00) d2669844-9894-11e7-a275-41b194c286cd [Error: SlackAPIError generated by your requestToken function]
END RequestId: d2669844-9894-11e7-a275-41b194c286cd
REPORT RequestId: d2669844-9894-11e7-a275-41b194c286cd Duration: 258.70 ms Billed Duration: 300 ms Memory Size: 1024 MBMax Memory Used: 23 MB

However, when I run it directly from the command line…

MacBook-Pro:serverless-chatbot hckia$ sls invoke -f install
{
“statusCode”: 302,
“headers”: {
“Location”: “https://s3-us-west-2.amazonaws.com/forex-dev-serverlessdeploymentbucket-o150tudg9vb9/success.html
}
}

Everything works out fine.

START RequestId: effcb7a5-98a2-11e7-8fbf-a1614258a0d9 Version: $LATEST
2017-09-13 09:45:23.966 (-07:00) effcb7a5-98a2-11e7-8fbf-a1614258a0d9 Requesting token with null
END RequestId: effcb7a5-98a2-11e7-8fbf-a1614258a0d9
REPORT RequestId: effcb7a5-98a2-11e7-8fbf-a1614258a0d9 Duration: 4.13 ms Billed Duration: 100 ms Memory Size: 1024 MBMax Memory Used: 22 MB


#4

Hey Cyrus, sorry to hear you’re having problems with the code. Thanks for buying the course!

I’ve posted a request for clarification over on your original A Cloud Guru post, but it looks like an issue with your CLIENT_SECRET environment variable from what I can see so far.


#5

Hey thanks for getting back to me man - I’ll follow up there and if we get stumped come back here to see if anyone has any information.


#6

Found the problem when looking at the code on my github repo.

CLIENT_SECRET was typed out as ClIENT_SECRET…

Null is a normal response from the command line, as it generates no token (I believe), but once I fixed that typo all was well…

START RequestId: 9c22ba3f-98df-11e7-ba0e-29a2ee4a0d83 Version: $LATEST
2017-09-13 16:59:42.576 (-07:00)	9c22ba3f-98df-11e7-ba0e-29a2ee4a0d83	Requesting token with 239594296340.240982104245.aa5b029618242ff653dfcbafd4a468420bc833bdd945f1f5424eb978639308a3
2017-09-13 16:59:42.577 (-07:00)	9c22ba3f-98df-11e7-ba0e-29a2ee4a0d83	Fetching https://slack.com/api/oauth.access?client_id=239594296340.240427417923&client_secret=EDITEDOUT&code=239594296340.240982104245.aa5b029618242ff653dfcbafd4a468420bc833bdd945f1f5424eb978639308a3
END RequestId: 9c22ba3f-98df-11e7-ba0e-29a2ee4a0d83
REPORT RequestId: 9c22ba3f-98df-11e7-ba0e-29a2ee4a0d83	Duration: 877.51 ms	Billed Duration: 900 ms 	Memory Size: 1024 MBMax Memory Used: 23 MB

Thanks again!