Description
⚠️ This issue respects the following points: ⚠️
- This is a bug, not a question or a configuration/webserver/proxy issue.
- This issue is not already reported on Github OR Nextcloud Community Forum (I've searched it).
- Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
- I agree to follow Nextcloud's Code of Conduct.
Bug description
If posting a simple JSON like this
{
"httpMethod": "POST",
"uri": "https://webhooks.example.comflows/trigger/94b2fd27-d517-4b6f-861f-d5b1b6b4d884",
"event": "OCP\Files\Events\Node\NodeReadEvent"
}
to the webhook endpoint of nextcloud. ( https://nc.example.com/ocs/v2.php/apps/webhook_listeners/api/v1/webhooks )
i get this error when posting the above json payload to the url to create a webhook. here is the curl example:
curl -H "Content-Type: application/json" -H "OCS-APIRequest: true" -u "admin:admin" "http://localhost:8090/ocs/v2.php/apps/webhook_listeners/api/v1/webhooks" -d @tmp/webhook.json
and here is the log and the response from nextcloud:
response:
:~$ curl -H "Content-Type: application/json" -H "OCS-APIRequest: true" -u "admin:admin" "http://localhost:8090/ocs/v2.php/apps/webhook_listeners/api/v1/webhooks" -d @tmp/webhook.json
<?xml version="1.0"?>
<ocs>
<meta>
<status>failure</status>
<statuscode>996</statuscode>
<message>Internal Server Error
OCA\WebhookListeners\Controller\WebhooksController::create(): Argument #1 ($httpMethod) must be of type string, null given, called in /var/www/html/lib/private/AppFramework/Http/Dispatcher.php on line 202 in file '/var/www/html/apps/webhook_listeners/lib/Controller/WebhooksController.php' line 127</message>
</meta>
<data/>
</ocs>
here is the log entry:
{"reqId":"Y1FlVXd9CFs9Uc64ZPOU","level":3,"time":"2025-01-26T06:08:45+00:00","remoteAddr":"172.17.0.1","user":"admin","app":"webhook_listeners","method":"POST","url":"/ocs/v2.php/apps/webhook_listeners/api/v1/webhooks","message":"------------------------------------- { \"httpMethod\": \"GET\", \"uri\": \"https://webhooks.example.com/flows/trigger/94b2fd27-d517-4b6f-861f-d5b1b6b4d884\", \"event\": \"OCP\\Files\\Events\\Node\\NodeReadEvent\"} | {\"httpMethod\":null,\"uri\":null,\"event\":null,\"eventFilter\":null,\"userIdFilter\":null,\"headers\":null,\"authMethod\":null,\"authData\":null}","userAgent":"curl/8.5.0","version":"31.0.0.12","data":{"app":"webhook_listeners"}}
{"reqId":"Y1FlVXd9CFs9Uc64ZPOU","level":3,"time":"2025-01-26T06:08:45+00:00","remoteAddr":"172.17.0.1","user":"admin","app":"no app in context","method":"POST","url":"/ocs/v2.php/apps/webhook_listeners/api/v1/webhooks","message":"OCA\\WebhookListeners\\Controller\\WebhooksController::create(): Argument #1 ($httpMethod) must be of type string, null given, called in /var/www/html/lib/private/AppFramework/Http/Dispatcher.php on line 202 in file '/var/www/html/apps/webhook_listeners/lib/Controller/WebhooksController.php' line 127","userAgent":"curl/8.5.0","version":"31.0.0.12","exception":{"Exception":"Exception","Message":"OCA\\WebhookListeners\\Controller\\WebhooksController::create(): Argument #1 ($httpMethod) must be of type string, null given, called in /var/www/html/lib/private/AppFramework/Http/Dispatcher.php on line 202 in file '/var/www/html/apps/webhook_listeners/lib/Controller/WebhooksController.php' line 127","Code":0,"Trace":[{"file":"/var/www/html/lib/private/AppFramework/App.php","line":161,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\WebhookListeners\\Controller\\WebhooksController"},"create"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":306,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\WebhookListeners\\Controller\\WebhooksController","create",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"_route":"ocs.webhook_listeners.webhooks.create"}]},{"file":"/var/www/html/ocs/v1.php","line":49,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/ocsapp/apps/webhook_listeners/api/v1/webhooks"]},{"file":"/var/www/html/ocs/v2.php","line":7,"args":["/var/www/html/ocs/v1.php"],"function":"require_once"}],"File":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","Line":146,"Previous":{"Exception":"TypeError","Message":"OCA\\WebhookListeners\\Controller\\WebhooksController::create(): Argument #1 ($httpMethod) must be of type string, null given, called in /var/www/html/lib/private/AppFramework/Http/Dispatcher.php on line 202","Code":0,"Trace":[{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":202,"function":"create","class":"OCA\\WebhookListeners\\Controller\\WebhooksController","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":114,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\WebhookListeners\\Controller\\WebhooksController"},"create"]},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":161,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\WebhookListeners\\Controller\\WebhooksController"},"create"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":306,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\WebhookListeners\\Controller\\WebhooksController","create",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"_route":"ocs.webhook_listeners.webhooks.create"}]},{"file":"/var/www/html/ocs/v1.php","line":49,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/ocsapp/apps/webhook_listeners/api/v1/webhooks"]},{"file":"/var/www/html/ocs/v2.php","line":7,"args":["/var/www/html/ocs/v1.php"],"function":"require_once"}],"File":"/var/www/html/apps/webhook_listeners/lib/Controller/WebhooksController.php","Line":127},"message":"OCA\\WebhookListeners\\Controller\\WebhooksController::create(): Argument #1 ($httpMethod) must be of type string, null given, called in /var/www/html/lib/private/AppFramework/Http/Dispatcher.php on line 202 in file '/var/www/html/apps/webhook_listeners/lib/Controller/WebhooksController.php' line 127","exception":{},"CustomMessage":"OCA\\WebhookListeners\\Controller\\WebhooksController::create(): Argument #1 ($httpMethod) must be of type string, null given, called in /var/www/html/lib/private/AppFramework/Http/Dispatcher.php on line 202 in file '/var/www/html/apps/webhook_listeners/lib/Controller/WebhooksController.php' line 127"}}
The first log entries is added by me to get the raw request body. After the pipe in the first log line is the output is from $this->reflector->getParameters() . Here is the code i added in this file /var/www/html/lib/private/AppFramework/Http/Dispatcher.php in line 180:
$rawBody = file_get_contents('php://input');
$this->logger->error("----------------------------- {output} | {all}",['output' => $rawBody,'all' => $this->reflector->getParameters()]);
Steps to reproduce
- Running docker with the devlopment container like this
docker run --name nextcloud-dev -e SERVER_BRANCH=v31.0.0rc1 --rm -p 8090:80 ghcr.io/juliusknorr/nextcloud-dev-php81:latest
whith the server branch set to
- v30.0.5
- v31.0.0.rc
- After dev env is up and running and the webhook_listeners app is enabled. you can directly curl the api
2.1. checking if auth works
check this for both versions
:~$ curl -X GET -H "Content-Type: application/json" -H "OCS-APIRequest: true" -u "admin:admin" "http://localhost:8090/ocs/v2.php/apps/webhook_listeners/api/v1/webhooks"
<?xml version="1.0"?>
<ocs>
<meta>
<status>ok</status>
<statuscode>200</statuscode>
<message>OK</message>
</meta>
<data/>
</ocs>
- Then posting the JSON payload like this:
:~$ curl -H "Content-Type: application/json" -H "OCS-APIRequest: true" -u "admin:admin" "http://localhost:8090/ocs/v2.php/apps/webhook_listeners/api/v1/webhooks" -d @tmp/webhook.json
<?xml version="1.0"?>
<ocs>
<meta>
<status>failure</status>
<statuscode>996</statuscode>
<message>Internal Server Error
OCA\WebhookListeners\Controller\WebhooksController::create(): Argument #1 ($httpMethod) must be of type string, null given, called in /var/www/html/lib/private/AppFramework/Http/Dispatcher.php on line 202 in file '/var/www/html/apps/webhook_listeners/lib/Controller/WebhooksController.php' line 127</message>
</meta>
<data/>
</ocs>
The payload is the same as i mentioned above in the bug description. i also tried to change the values in the payload and to escape.
i tested this also on a already running instance of nextcloud which is also on version 30.0.5 with the same output
Expected behavior
The expected behavoir is that a webhook for the specified event is created.
Nextcloud Server version
30
Operating system
Other
PHP engine version
PHP 8.1
Web server
Apache (supported)
Database engine version
SQlite
Is this bug present after an update or on a fresh install?
Fresh Nextcloud Server install
Are you using the Nextcloud Server Encryption module?
None
What user-backends are you using?
- Default user-backend (database)
- LDAP/ Active Directory
- SSO - SAML
- Other
Configuration report
root@1741b37bd14e:/var/www/html# sudo -u www-data php occ config:list system
{
"system": {
"debug": true,
"profiler": true,
"apps_paths": [
{
"path": "\/var\/www\/html\/apps",
"url": "\/apps",
"writable": false
},
{
"path": "\/var\/www\/html\/apps-extra",
"url": "\/apps-extra",
"writable": false
},
{
"path": "\/var\/www\/html\/apps-shared",
"url": "\/apps-shared",
"writable": false
},
{
"path": "\/var\/www\/html\/apps-writable",
"url": "\/apps-writable",
"writable": true
}
],
"allow_local_remote_servers": true,
"mail_from_address": "***REMOVED SENSITIVE VALUE***",
"mail_smtpmode": "smtp",
"mail_sendmailmode": "smtp",
"mail_domain": "***REMOVED SENSITIVE VALUE***",
"mail_smtphost": "***REMOVED SENSITIVE VALUE***",
"mail_smtpport": "1025",
"skeletondirectory": "\/skeleton",
"setup_create_db_user": false,
"loglevel": 2,
"log_query": false,
"query_log_file": "\/shared\/log\/querylog-.log",
"query_log_file_requestid": "yes",
"diagnostics.logging": false,
"diagnostics.logging.threshold": 0,
"log.condition": {
"apps": [
"diagnostics",
"admin_audit"
]
},
"passwordsalt": "***REMOVED SENSITIVE VALUE***",
"secret": "***REMOVED SENSITIVE VALUE***",
"trusted_domains": [
"localhost",
"nextcloud",
"172.17.0.2",
"localhost"
],
"datadirectory": "***REMOVED SENSITIVE VALUE***",
"dbtype": "sqlite3",
"version": "31.0.0.12",
"overwrite.cli.url": "http:\/\/localhost",
"updater.release.channel": "git",
"installed": true,
"instanceid": "***REMOVED SENSITIVE VALUE***",
"lookup_server": "",
"memcache.local": "\\OC\\Memcache\\APCu",
"trusted_proxies": "***REMOVED SENSITIVE VALUE***"
}
}
List of activated Apps
root@1741b37bd14e:/var/www/html# sudo -u www-data php occ app:list
Enabled:
- cloud_federation_api: 1.14.0
- comments: 1.21.0
- contactsinteraction: 1.12.0
- dashboard: 7.11.0
- dav: 1.33.0
- federatedfilesharing: 1.21.0
- federation: 1.21.0
- files: 2.3.1
- files_reminders: 1.4.0
- files_sharing: 1.23.1
- files_trashbin: 1.21.0
- files_versions: 1.24.0
- lookup_server_connector: 1.19.0
- oauth2: 1.19.1
- profile: 1.0.0
- provisioning_api: 1.21.0
- settings: 1.14.0
- sharebymail: 1.21.0
- systemtags: 1.21.1
- theming: 2.6.1
- twofactor_backupcodes: 1.20.0
- updatenotification: 1.21.0
- user_status: 1.11.0
- weather_status: 1.11.0
- webhook_listeners: 1.2.0
- workflowengine: 2.13.0
Disabled:
- admin_audit: 1.21.0
- encryption: 2.19.0
- files_external: 1.23.0
- testing: 1.21.0
- user_ldap: 1.22.0
Nextcloud Signing status
in the development container as mentioned above
i get this error
Integrity checker has been disabled. Integrity cannot be verified.
Nextcloud Logs
the nextcloud logs for that are already in the bug description
Additional info
No response