RocketChat / Rocket.Chat.Apps-engine

The Rocket.Chat Apps engine and definitions.
https://rocketchat.github.io/Rocket.Chat.Apps-engine/
MIT License
116 stars 118 forks source link

Issue with implemented executeBlockActionHandler after updating RocketChat docker to latest version #801

Open thelazyindian opened 2 months ago

thelazyindian commented 2 months ago

Usecase:

Omnichannel chatbot using botpress and rocket chat.

Previous RC version: v6.6.6 Current RC version: v6.12.0

Botpress Connector: https://github.com/mrsric/botpress-connector

Error at line: https://github.com/mrsric/botpress-connector/blob/main/handler/ExecuteLivechatBlockActionHandler.ts#L23

Directly logging context.getInteractionData() shows this output https://katb.in/qerixenexuj but while accessing the individual properties in the above line from context.getInteractionData(), all of them returning null/undefined

This issue is specifically happening after I updated Rocket Chat to the latest version.

Error:

[
  "{\"stack\":\"TypeError: Cannot read properties of undefined (reading 'id')
    at HM.run (eval at wrapAppCode (file:///app/bundle/programs/server/npm/node_modules/@rocket.chat/apps-engine/deno-runtime/handlers/app/construct.ts:56:10), <anonymous>:20:848395)
    at $M.executeLivechatBlockActionHandler (eval at wrapAppCode (file:///app/bundle/programs/server/npm/node_modules/@rocket.chat/apps-engine/deno-runtime/handlers/app/construct.ts:56:10), <anonymous>:20:852719)
    at handleUIKitInteraction (file:///app/bundle/programs/server/npm/node_modules/@rocket.chat/apps-engine/deno-runtime/handlers/uikit/handler.ts:71:41)
    at handleApp (file:///app/bundle/programs/server/npm/node_modules/@rocket.chat/apps-engine/deno-runtime/handlers/app/handler.ts:33:16)
    at requestRouter (file:///app/bundle/programs/server/npm/node_modules/@rocket.chat/apps-engine/deno-runtime/main.ts:73:26)
    at main (file:///app/bundle/programs/server/npm/node_modules/@rocket.chat/apps-engine/deno-runtime/main.ts:112:22)
    at eventLoopTick (ext:core/01_core.js:183:11)\",\"message\":\"Cannot read properties of undefined (reading 'id')\"}"
]

RocketChat AppsEngine CLI version: 1.11.1

Solutions that I Tested (none worked):

  1. Added missing implementation for class IUIKitLivechatInteractionHandler in BotpressConnectorApp.ts
  2. RC Apps CLI ver upgraded from 1.11.0->1.11.1
  3. Updated @rocket.chat/apps-engine devDep version from 1.25.0 to 1.44.0 and also downgraded to 1.17.0
  4. Uninstalled and clean installed app in rocket chat.
dudanogueira commented 2 months ago

hi @thelazyindian !

I got a fixed version here: https://github.com/dudanogueira/Rocket.Chat.Botpress.OmnichannelConnector.App/releases/tag/0.0.10

The problem is that interactionData has moved places. Not sure if it was a breaking change or not.