Closed RiyaMRoy04 closed 6 years ago
What version of middleware are you using? Please show the code of your before function and at least a few lines of stacktrace,
@Naktibalda I am using "botkit-middleware-watson": "^1.5.0" and I am trying to pass emotion(obtained from Tone analyzer) as context to Conversation service. emotTone variable has the emotion conversationPayload.context['emotions']=emotTone;
Stacktrace:
/home/vcap/app/app.js:75
2017-11-07T19:38:49.22+0530 [APP/PROC/WEB/0]ERR conversationPayload.context['emotions']=emotTone;
2017-11-07T19:38:49.22+0530 [APP/PROC/WEB/0]ERR ^
2017-11-07T19:38:49.22+0530 [APP/PROC/WEB/0]ERR TypeError: Cannot set property 'emotions' of undefined
2017-11-07T19:38:49.22+0530 [APP/PROC/WEB/0]ERR at /home/vcap/app/app.js:75:52
2017-11-07T19:38:49.22+0530 [APP/PROC/WEB/0]ERR at Request._callback (/home/vcap/app/node_modules/watson-developer-cloud/lib/requestwrapper.js:105:5)
2017-11-07T19:38:49.22+0530 [APP/PROC/WEB/0]ERR at Request.self.callback (/home/vcap/app/node_modules/request/request.js:186:22)
2017-11-07T19:38:49.22+0530 [APP/PROC/WEB/0]ERR at emitTwo (events.js:106:13)
2017-11-07T19:38:49.22+0530 [APP/PROC/WEB/0]ERR at Request.emit (events.js:191:7)
2017-11-07T19:38:49.22+0530 [APP/PROC/WEB/0]ERR at Request.<anonymous> (/home/vcap/app/node_modules/request/request.js:1163:10)
2017-11-07T19:38:49.22+0530 [APP/PROC/WEB/0]ERR at emitOne (events.js:96:13)
2017-11-07T19:38:49.22+0530 [APP/PROC/WEB/0]ERR at Request.emit (events.js:188:7)
2017-11-07T19:38:49.22+0530 [APP/PROC/WEB/0]ERR at Gunzip.<anonymous> (/home/vcap/app/node_modules/request/request.js:1085:12)
2017-11-07T19:38:49.22+0530 [APP/PROC/WEB/0]ERR at Gunzip.g (events.js:292:16)
2017-11-07T19:38:49.22+0530 [APP/PROC/WEB/0]ERR at emitNone (events.js:91:20)
2017-11-07T19:38:49.22+0530 [APP/PROC/WEB/0]ERR at Gunzip.emit (events.js:185:7)
2017-11-07T19:38:49.22+0530 [APP/PROC/WEB/0]ERR at endReadableNT (_stream_readable.js:974:12)
2017-11-07T19:38:49.22+0530 [APP/PROC/WEB/0]ERR at _combinedTickCallback (internal/process/next_tick.js:80:11)
2017-11-07T19:38:49.22+0530 [APP/PROC/WEB/0]ERR at process._tickCallback (internal/process/next_tick.js:104:9)
It looks like your payload has no context.
Are you trying to update context of the first message in the session? Context does not exist until you get the first response from Watson Conversion, so you have to add context property to payload yourself if it is undefined.
@RiyaMRoy04 have you solved this issue?
closing due to inactivity
I am unable to pass context from before function to conversation service! Hitting with error TypeError: Cannot set property of undefined. Am I missing something? Please help.