Closed Venkatesh6840 closed 4 years ago
any update on this ??
Activation: 'slackapp-register' (e5059fc3f1ff42b1859fc3f1ff52b1ea)
[
"2019-11-19T13:38:33.876239Z stdout: Registering new bot from Slack",
"2019-11-19T13:38:33.879318Z stdout: { ow_headers:",
"2019-11-19T13:38:33.879329Z stdout: { accept:",
"2019-11-19T13:38:33.879333Z stdout: 'text/html, application/xhtml+xml, application/xml;q=0.9, image/webp, image/apng, /;q=0.8, application/signed-exchange; v=b3',",
"2019-11-19T13:38:33.879337Z stdout: 'accept-encoding': 'gzip',",
"2019-11-19T13:38:33.879341Z stdout: 'accept-language': 'en-GB, en-US;q=0.9, en;q=0.8',",
"2019-11-19T13:38:33.879344Z stdout: 'cache-control': 'max-age=0',",
"2019-11-19T13:38:33.879348Z stdout: 'cdn-loop': 'cloudflare',",
"2019-11-19T13:38:33.879352Z stdout: 'cf-connecting-ip': '129.41.164.67',",
"2019-11-19T13:38:33.879355Z stdout: 'cf-ipcountry': 'IN',",
"2019-11-19T13:38:33.879359Z stdout: 'cf-ray': '538295c97ef48a6b-BOM',",
"2019-11-19T13:38:33.879362Z stdout: 'cf-visitor': '{\"scheme\":\"https\"}',",
"2019-11-19T13:38:33.879366Z stdout: cookie: 'cfduid=d4213fa152f7bd916b425442fca2d5ac01574167891',",
"2019-11-19T13:38:33.879370Z stdout: host: 'openwhisk.ng.bluemix.net',",
"2019-11-19T13:38:33.879373Z stdout: 'sec-fetch-mode': 'navigate',",
"2019-11-19T13:38:33.879377Z stdout: 'sec-fetch-site': 'cross-site',",
"2019-11-19T13:38:33.879380Z stdout: 'sec-fetch-user': '?1',",
"2019-11-19T13:38:33.879384Z stdout: 'upgrade-insecure-requests': '1',",
"2019-11-19T13:38:33.879388Z stdout: 'user-agent':",
"2019-11-19T13:38:33.879392Z stdout: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36',",
"2019-11-19T13:38:33.879396Z stdout: 'x-forwarded-for': '129.41.164.67, 172.68.162.106',",
"2019-11-19T13:38:33.879399Z stdout: 'x-forwarded-host': 'openwhisk.ng.bluemix.net',",
"2019-11-19T13:38:33.879403Z stdout: 'x-forwarded-port': '443',",
"2019-11-19T13:38:33.879407Z stdout: 'x-forwarded-proto': 'https',",
"2019-11-19T13:38:33.879410Z stdout: 'x-global-k8fdic-transaction-id': 'a5efe2688b81757a6089ace7787d4f56',",
"2019-11-19T13:38:33.879414Z stdout: 'x-real-ip': '172.68.162.106',",
"2019-11-19T13:38:33.879417Z stdout: 'x-request-id': 'a5efe2688b81757a6089ace7787d4f56' },",
"2019-11-19T13:38:33.879421Z stdout: ow_method: 'get',",
"2019-11-19T13:38:33.879425Z stdout: ow_path: '',",
"2019-11-19T13:38:33.879429Z stdout: cloudantDb: 'registrations',",
"2019-11-19T13:38:33.879432Z stdout: cloudantUrl:",
"2019-11-19T13:38:33.879436Z stdout: 'https://88ca350c-f724-4a30-8e90-ec2f7d50ceb3-bluemix:2faea02e7aff915a20e4de6d2ce67bfe0877fd8a82c3e8abeff75baf5d38bd10@88ca350c-f724-4a30-8e90-ec2f7d50ceb3-bluemix.cloudantnosqldb.appdomain.cloud',",
"2019-11-19T13:38:33.879440Z stdout: code:",
"2019-11-19T13:38:33.879443Z stdout: '628987376727.840388074613.2e88f9e7ab7ce6f213a17328936b9ff1900f0d44a775871449be82b2cc12f329',",
"2019-11-19T13:38:33.879447Z stdout: slackClientId: 628987376727.629,",
"2019-11-19T13:38:33.879450Z stdout: slackClientSecret: '1ecb22b1582c8794db280002fd369132',",
"2019-11-19T13:38:33.879454Z stdout: slackVerificationToken: 'LUkfDxt7Ke1G6yLCGoPbSKr3',",
"2019-11-19T13:38:33.879458Z stdout: state: '' }",
"2019-11-19T13:38:33.881280Z stderr: { Error: Cannot find module 'cloudant'",
"2019-11-19T13:38:33.881308Z stderr: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)",
"2019-11-19T13:38:33.881313Z stderr: at Function.Module._load (internal/modules/cjs/loader.js:562:25)",
"2019-11-19T13:38:33.881317Z stderr: at Module.require (internal/modules/cjs/loader.js:692:17)",
"2019-11-19T13:38:33.881321Z stderr: at require (internal/modules/cjs/helpers.js:25:18)",
"2019-11-19T13:38:33.881325Z stderr: at NodeActionRunner.main [as userScriptMain] (eval at initializeActionHandler (/nodejsAction/runner.js:57:23),
Try updating the require statements since according to the docs migrating from Node v8 to Node v10 deprecates use of the cloudant
package and replaces it with the scoped copy @cloudant/cloudant
. https://cloud.ibm.com/docs/openwhisk?topic=cloud-functions-runtimes#migrating-from-nodejs-8-to-nodejs-10
Hi , I installed latest @cloudant/cloudant and added require 'require('@cloudant/cloudant')', now the issue is resolved , but when i tried to "Add to slack: getting below error and { "code": "1195d87cfe72a254ee4ff1df6c7ff07e", "error": "The requested resource does not exist." }
and in Bluemix i tried to Invoke only slack-register code i got the below error in log
Activation ID: 7f07adc30dba440287adc30dbaa40259 Results:
{ "error": { "body": "Registration failed" } }
Logs:
[ "2019-11-20T12:08:10.824910Z stdout: Registering new bot from Slack", "2019-11-20T12:08:10.824958Z stdout: { cloudantDb: 'registrations',", "2019-11-20T12:08:10.824963Z stdout: cloudantUrl:", "2019-11-20T12:08:10.824968Z stdout: 'https://88ca350c-f724-4a30-8e90-ec2f7d50ceb3-bluemix:2faea02e7aff915a20e4de6d2ce67bfe0877fd8a82c3e8abeff75baf5d38bd10@88ca350c-f724-4a30-8e90-ec2f7d50ceb3-bluemix.cloudantnosqldb.appdomain.cloud',", "2019-11-20T12:08:10.824972Z stdout: slackClientId: 628987376727.629,", "2019-11-20T12:08:10.824976Z stdout: slackClientSecret: '1ecb22b1582c8794db280002fd369132',", "2019-11-20T12:08:10.824980Z stdout: slackVerificationToken: 'LUkfDxt7Ke1G6yLCGoPbSKr3' }", "2019-11-20T12:08:10.935569Z stdout: { ok: false, error: 'invalid_code' }" ]
You may want to retry the steps again from the start and verify that the set up is correct. Just make sure that instead of require('cloudant')
you use require('@cloudant/cloudant')
in the action files. I was able to run through the set up yesterday and it worked for me.
I tried the steps again , but still getting the same message
Activation: 'slackapp-register' (bdb14b8c16c2492bb14b8c16c2892b2b) [ "2019-11-21T03:22:14.367237Z stdout: Registering new bot from Slack", "2019-11-21T03:22:14.367268Z stdout: { cloudantDb: 'registrations',", "2019-11-21T03:22:14.367272Z stdout: cloudantUrl:", "2019-11-21T03:22:14.367275Z stdout: 'https://88ca350c-f724-4a30-8e90-ec2f7d50ceb3-bluemix:2faea02e7aff915a20e4de6d2ce67bfe0877fd8a82c3e8abeff75baf5d38bd10@88ca350c-f724-4a30-8e90-ec2f7d50ceb3-bluemix.cloudantnosqldb.appdomain.cloud',", "2019-11-21T03:22:14.367278Z stdout: slackClientId: 628987376727.629,", "2019-11-21T03:22:14.367281Z stdout: slackClientSecret: '1ecb22b1582c8794db280002fd369132',", "2019-11-21T03:22:14.367284Z stdout: slackVerificationToken: 'LUkfDxt7Ke1G6yLCGoPbSKr3' }", "2019-11-21T03:22:14.616559Z stdout: { ok: false, error: 'invalid_code' }" ]
my local.cmd file is set CLOUDANT_url=https://88ca350c-f724-4a30-8e90-ec2f7d50ceb3-bluemix:2faea02e7aff915a20e4de6d2ce67bfe0877fd8a82c3e8abeff75baf5d38bd10@88ca350c-f724-4a30-8e90-ec2f7d50ceb3-bluemix.cloudantnosqldb.appdomain.cloud set CLOUDANT_db=registrations set SLACK_CLIENT_ID=628987376727.628990503271 set SLACK_CLIENT_SECRET=1ecb22b1582c8794db280002fd369132 set SLACK_VERIFICATION_TOKEN=LUkfDxt7Ke1G6yLCGoPbSKr3
im having a doubt my cliend id is - 628987376727.628990503271 , but in bluemix site it is rounding to 628987376727.629 is this causing the issue ?
That could be the cause, in my logs it shows the full client ID. I'm not sure how to fix that though.
It's probably failing during oauth access https://api.slack.com/methods/oauth.access. If it's successful it should return the following response in the console output:
{
"ok": true,
"access_token": "xoxp-XXXXXXXX-XXXXXXXX-XXXXX",
"scope": "incoming-webhook,commands,bot",
"team_name": "Team Installing Your Hook",
"team_id": "TXXXXXXXXX",
"enterprise_id": null,
"incoming_webhook": {
"url": "https://hooks.slack.com/TXXXXX/BXXXXX/XXXXXXXXXX",
"channel": "#channel-it-will-post-to",
"configuration_url": "https://teamname.slack.com/services/BXXXXX"
},
"bot": {
"bot_user_id": "UTTTTTTTTTTR",
"bot_access_token": "xoxb-XXXXXXXXXXXX-TTTTTTTTTTTTTT"
}
}
I tried the steps again , but still getting the same message
Activation: 'slackapp-register' (bdb14b8c16c2492bb14b8c16c2892b2b) [ "2019-11-21T03:22:14.367237Z stdout: Registering new bot from Slack", "2019-11-21T03:22:14.367268Z stdout: { cloudantDb: 'registrations',", "2019-11-21T03:22:14.367272Z stdout: cloudantUrl:", "2019-11-21T03:22:14.367275Z stdout: 'https://88ca350c-f724-4a30-8e90-ec2f7d50ceb3-bluemix:[2faea02e7aff915a20e4de6d2ce67bfe0877fd8a82c3e8abeff75baf5d38bd10@88ca350c-f724-4a30-8e90-ec2f7d50ceb3-bluemix.cloudantnosqldb.appdomain.cloud](mailto:2faea02e7aff915a20e4de6d2ce67bfe0877fd8a82c3e8abeff75baf5d38bd10@88ca350c-f724-4a30-8e90-ec2f7d50ceb3-bluemix.cloudantnosqldb.appdomain.cloud)',", "2019-11-21T03:22:14.367278Z stdout: slackClientId: 628987376727.629,", "2019-11-21T03:22:14.367281Z stdout: slackClientSecret: '1ecb22b1582c8794db280002fd369132',", "2019-11-21T03:22:14.367284Z stdout: slackVerificationToken: 'LUkfDxt7Ke1G6yLCGoPbSKr3' }", "2019-11-21T03:22:14.616559Z stdout: { ok: false, error: 'invalid_code' }" ]
Actually I notice what's wrong. You're missing a temporary oauth code in your args when the register script is called. Hence the invalid_code
error. How are you calling the script? Are you doing it through Add to Slack
button? I'm not sure if other methods will work. Also, if you previously registered the bot, you'll need to remove that entry from the database as the code for removing an existing bot crashes.
The issue is with Client ID ,actual id of mine is - 628987376727.628990503271 , but in blue mix it is rounding off to 628987376727.629 , i changed it to string "628987376727.628990503271" under parameters section
after the change now i tried to add my app through "Add to slack" button , now the registration is successful and now able to get responses from slack bot
Thank you @ktsuench for your valuable support 😊
"2019-08-26T01:58:58.117281Z stderr: { Error: Cannot find module 'cloudant'", "2019-08-26T01:58:58.117297Z stderr: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)", "2019-08-26T01:58:58.117303Z stderr: at Function.Module._load (internal/modules/cjs/loader.js:508:25)", "2019-08-26T01:58:58.117326Z stderr: at Module.require (internal/modules/cjs/loader.js:637:17)", "2019-08-26T01:58:58.117330Z stderr: at require (internal/modules/cjs/helpers.js:22:18)", "2019-08-26T01:58:58.117334Z stderr: at NodeActionRunner.main [as userScriptMain] (eval at initializeActionHandler (/nodejsAction/runner.js:57:23),:59:18)",
"2019-08-26T01:58:58.117338Z stderr: at Promise (/nodejsAction/runner.js:73:35)",
"2019-08-26T01:58:58.117342Z stderr: at new Promise ()",
"2019-08-26T01:58:58.117346Z stderr: at NodeActionRunner.run (/nodejsAction/runner.js:71:16)",
"2019-08-26T01:58:58.117350Z stderr: at doRun (/nodejsAction/src/service.js:185:14)",
"2019-08-26T01:58:58.117353Z stderr: at runCode (/nodejsAction/src/service.js:141:20) code: 'MODULE_NOT_FOUND' }",
"2019-08-26T01:58:58.118Z stderr: The action did not initialize or run as expected. Log data might be missing."