getActions undefined in Rules inline script

  • Platform information:
    • Hardware:
      • Platform = lxc

      • CPU Usage = 1.29% avg over 2 cpu(s) (4 core(s) x 1 socket(s))

        CPU Load = 1m: 0.04, 5m: 0.12, 15m: 0.09

        Memory = Free: 0.01GB (1%), Used: 1.98GB (99%), Total: 2.00GB

        Swap = Free: 1.89GB (95%), Used: 0.10GB (5%), Total: 2.00GB

        Root = Free: 2.97GB (40%), Used: 4.38GB (60%), Total: 7.77GB

    • OS:
      • Kernel = Linux 6.8.12-13-pve
      • Release = Debian GNU/Linux 12 (bookworm)
    • Java Runtime Environment: which java platform is used and what version
      • openjdk 21.0.8 2025-07-15 LTS
        OpenJDK Runtime Environment Temurin-21.0.8+9 (build 21.0.8+9-LTS)
        OpenJDK 64-Bit Server VM Temurin-21.0.8+9 (build 21.0.8+9-LTS, mixed mode, sharing)
    • openHAB version: openHAB 5.0.1
  • Issue of the topic:
  • I converted a rule from DSL to ECMAScript version 11, but the script complains that getActions is undefined. I’m using the JS Scripting addon that I added via the GUI. I tried adding the require statement, but then it complains on that line. Somehow I think something is not installed correctly.
  • Any suggestions on how I should troubleshoot this issue?
getAction Error Message

Logger Class
org.openhab.core.automation.module.script.internal.handler.AbstractScriptModuleHandler
Message
Script execution of rule with UID 'rfbridgeUpdate' failed: ReferenceError: "getActions" is not defined in <eval> at line number 5 at column number 22

Require Statement Error Message

Logger Class
org.openhab.core.automation.module.script.internal.handler.AbstractScriptModuleHandler
Message
Script execution of rule with UID 'rfbridgeUpdate' failed: java.lang.NullPointerException: Cannot invoke "java.nio.file.Path.resolve(String)" because the return value of "java.nio.file.Path.getRoot()" is null
    //var {actions} = require('@openhab');

    //val telegramAction = getActions("telegram","telegram:telegramBot:<uid>")
    //telegramAction = actions.get("telegram", "telegramBot:telegramBot:4235352856");
    telegramAction = getActions("telegram","telegram:telegramBot:Downey");

    currentTime = new Date();
    formattedTime = `${String(currentTime.getMonth() + 1).padStart(2, '0')}${String(currentTime.getDate()).padStart(2, '0')} `;

    rfSensor = items.getItem("RFBridge_Result").state.toString();
    console.log("RfBridge Result is " + rfSensor);

    if (items.getItem("AlarmModeSW").state.toString() === "ON") {
      switch (rfSensor) {
        case "E3125E":
          console.log("Motion has been activated");

That’s because that’s not how you access actions in JS. See JavaScript Scripting - Automation | openHAB for the full docs on accessing actions.

Clicking through the links shows you should use

actions.thingActions("bindingID", "thingID");

Thanks @rlkoshak . I reviewed JavaScript Scripting - Automation | openHAB and clicked on actions, but I couldn’t make sense of the details. I replaced “getActions” with “actions.thingActions” and it worked. Thank you!