Server script is not working at all

Hi,

I’m pretty new to ERPNext and very impressed. While I’m getting my feet wet with starting to use scripting, I have trouble to activate server script.

I’m using the docker images provided by frappe.

I activated server side scripting via:
bench --site frontend set-config server_script_enabled true

common_site_config.json looks like this:
{
“db_host”: “db”,
“db_port”: 3306,
“default_site”: “frontend”,
“log_level”: “DEBUG”,
“redis_cache”: “redis://redis-cache:6379”,
“redis_queue”: “redis://redis-queue:6379”,
“redis_socketio”: “redis://redis-queue:6379”,
“server_script_enabled”: 1,
“socketio_port”: 9000
}

site_config.json looks like this
{
“db_name”: “_myDBname”,
“db_password”: “mypassword”,
“db_type”: “mariadb”,
“encryption_key”: “myVeryLongEncryptionKey”,
“server_script_enabled”: true,
“developer_mode”: 1
}

I created a testscript via https://erp.mysite.com/app/server-script

Script Type: API
API Method: /api/method/testscript
Checkbox Disabled: deactivated

Script:

 import frappe
 
@frappe.whitelist()
def testscript():
    return "Server Script is working correctly!"

Whenever I’m trying to call https://erp.mysite.com/api/method/testscript I get this error:

Traceback (most recent call last):
  File "apps/frappe/frappe/handler.py", line 74, in execute_cmd
    method = get_attr(cmd)
             ^^^^^^^^^^^^^
  File "apps/frappe/frappe/handler.py", line 293, in get_attr
    method = globals()[cmd]
             ~~~~~~~~~^^^^^
KeyError: 'testscript'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 114, in application
    response = frappe.api.handle(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/api/__init__.py", line 49, in handle
    data = endpoint(**arguments)
           ^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/api/v1.py", line 36, in handle_rpc_call
    return frappe.handler.handle()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/handler.py", line 49, in handle
    data = execute_cmd(cmd)
           ^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/handler.py", line 76, in execute_cmd
    frappe.throw(_("Failed to get method for command {0} with {1}").format(cmd, e))
  File "apps/frappe/frappe/__init__.py", line 602, in throw
    msgprint(
  File "apps/frappe/frappe/__init__.py", line 567, in msgprint
    _raise_exception()
  File "apps/frappe/frappe/__init__.py", line 518, in _raise_exception
    raise exc
frappe.exceptions.ValidationError: Failed to get method for command testscript with 'testscript'

docker logs show this:

backend-1       | Traceback (most recent call last):
backend-1       |   File "apps/frappe/frappe/handler.py", line 74, in execute_cmd
backend-1       |     method = get_attr(cmd)
backend-1       |              ^^^^^^^^^^^^^
backend-1       |   File "apps/frappe/frappe/handler.py", line 293, in get_attr
backend-1       |     method = globals()[cmd]
backend-1       |              ~~~~~~~~~^^^^^
backend-1       | KeyError: 'testscript'
backend-1       | 
backend-1       | During handling of the above exception, another exception occurred:
backend-1       | 
backend-1       | Traceback (most recent call last):
backend-1       |   File "apps/frappe/frappe/app.py", line 114, in application
backend-1       |     response = frappe.api.handle(request)
backend-1       |                ^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-1       |   File "apps/frappe/frappe/api/__init__.py", line 49, in handle
backend-1       |     data = endpoint(**arguments)
backend-1       |            ^^^^^^^^^^^^^^^^^^^^^
backend-1       |   File "apps/frappe/frappe/api/v1.py", line 36, in handle_rpc_call
backend-1       |     return frappe.handler.handle()
backend-1       |            ^^^^^^^^^^^^^^^^^^^^^^^
backend-1       |   File "apps/frappe/frappe/handler.py", line 49, in handle
backend-1       |     data = execute_cmd(cmd)
backend-1       |            ^^^^^^^^^^^^^^^^
backend-1       |   File "apps/frappe/frappe/handler.py", line 76, in execute_cmd
backend-1       |     frappe.throw(_("Failed to get method for command {0} with {1}").format(cmd, e))
backend-1       |   File "apps/frappe/frappe/__init__.py", line 602, in throw
backend-1       |     msgprint(
backend-1       |   File "apps/frappe/frappe/__init__.py", line 567, in msgprint
backend-1       |     _raise_exception()
backend-1       |   File "apps/frappe/frappe/__init__.py", line 518, in _raise_exception
backend-1       |     raise exc
backend-1       | frappe.exceptions.ValidationError: Failed to get method for command testscript with 'testscript'

Neither the bench.log nor the frappe.log show any errors in this regard.

What am I doing wrong and how can I resolve this? Any idea would be very much appreciated.

Thanks - Gerald