Can't access bot in custom Action

I simply tried to do console.log(bot) in my action but I get a

ReferenceError: bot is not defined

But from what I can read in the documentation about Actions, it should be available alongside other arguments (other arguments that I am able to access).

I tried to look at the Memory section but it’s unclear why this occurs.


(also the System Parameters part in the doc is not rendering as intended)

Hi @vgalisson

Can you show us the complete file of that action?

When you return a function in your action, you need to pass the globals to that function. What about the other globals, are those defined?

/Crixx

Weirdly I am able to access temp or session but not bot.

My file is just

console.log(bot)

Nothing before except comments and nothing after.

The Stack Trace is :

09:37:29.828 ActionService An error occurred while executing the action "recherche/searchValue [ ReferenceError, bot is not defined]
STACK TRACE
ReferenceError: bot is not defined
at Object. (vm.js:10:14)
at NodeVM.run (C:\snapshot\build-windows\node_modules\vm2\lib\main.js:428:23)
at runInVm.Promise (C:\snapshot\build-windows\out\bp\core\services\action\vm.js:0:0)
at Promise._execute (~\botpress\modules.cache\module__413477195fa0b06d25e9a1bf929d1d2f3db1cef40a689f5fe961392dfcddc8ee\node_production_modules\bluebird\js\release\debuggability.js:313:9)
at Promise._resolveFromExecutor (~\botpress\modules.cache\module__413477195fa0b06d25e9a1bf929d1d2f3db1cef40a689f5fe961392dfcddc8ee\node_production_modules\bluebird\js\release\promise.js:483:18)
at new Promise (~\botpress\modules.cache\module__413477195fa0b06d25e9a1bf929d1d2f3db1cef40a689f5fe961392dfcddc8ee\node_production_modules\bluebird\js\release\promise.js:79:10)
at VmRunner.runInVm (C:\snapshot\build-windows\out\bp\core\services\action\vm.js:0:0)
at ScopedActionService. (C:\snapshot\build-windows\out\bp\core\services\action\action-service.js:0:0)
at Generator.next ()
at fulfilled (C:\snapshot\build-windows\out\bp\core\services\action\action-service.js:0:0)