opnsense / core

OPNsense GUI, API and systems backend
https://opnsense.org/
BSD 2-Clause "Simplified" License
3.07k stars 700 forks source link

os-wol api giving error on cURL request #7490

Closed James-Tarran closed 4 weeks ago

James-Tarran commented 4 weeks ago

Important notices Before you add a new report, we ask you kindly to acknowledge the following:

Describe the bug Sending a POST cURL to /api/wol/wol/wakeall results in the error {"errorMessage":"Unexpected error, check log for details"}

To Reproduce Steps to reproduce the behavior:

#!/bin/bash

# Set variables
OPNSENSE_IP="xxx.xxx.xxx.xxx"
interface_name="opt1"
mac_address="xx:xx:xx:xx:xx:xx"
key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
secret="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

# Send Wake-on-LAN request
curl -k -X POST -u "$key":"$secret" -H "Content-Length: 0" https://$OPNSENSE_IP/api/wol/wol/wakeall

Expected behavior WOL packet is sent to all device in /ui/WOL

Relevant log files

Crash report: 
[28-May-2024 13:12:20 Europe/London] Error: Call to undefined method OPNsense\Mvc\Dispatcher::getActionName() in /usr/local/opnsense/mvc/app/controllers/OPNsense/Base/ApiControllerBase.php:271
Stack trace:
#0 /usr/local/opnsense/mvc/app/library/OPNsense/Mvc/Dispatcher.php(152): OPNsense\Base\ApiControllerBase->beforeExecuteRoute(Object(OPNsense\Mvc\Dispatcher))
opnsense/plugins#1 /usr/local/opnsense/mvc/app/library/OPNsense/Mvc/Router.php(156): OPNsense\Mvc\Dispatcher->dispatch(Object(OPNsense\Mvc\Request), Object(OPNsense\Mvc\Response), Object(OPNsense\Mvc\Session))
opnsense/plugins#2 /usr/local/opnsense/mvc/app/library/OPNsense/Mvc/Router.php(139): OPNsense\Mvc\Router->performRequest(Object(OPNsense\Mvc\Dispatcher))
opnsense/plugins#3 /usr/local/opnsense/www/api.php(36): OPNsense\Mvc\Router->routeRequest('/api/wol/wol/se...')
opnsense/plugins#4 {main}

Additional context Works fine via the UI Issues persists in both os-wol-devel and os-wol

Environment opnsense-devel 24.7.b amd64 os-wol-devel 2.4_2

fichtner commented 4 weeks ago

Looks like a core issue (development version)... I'm moving it over for @AdSchellevis