nextcloud / nextcloud/richdocuments

mobile editor flow / api /ocs/v2.php/apps/richdocuments/api/v1/document not working

Open
#5,292 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

need to reproduce
Dominant language
JavaScript
Stars
453
Forks
147
Avg merge
14h 54m
Merged PRs (30d)
83

Description

Describe the bug
I am running nextcloud 32.0.5 ( docker.io/library/nextcloud:32.0.5 on kubernetes with https://github.com/nextcloud/helm - with external CODE also deployed on kubernetes).

Using collabora (nextcloud office) works fine in web. Hoewever, trying to extend integration into another app I hit a wall when trying to embed collabora.

I tried to follow https://github.com/nextcloud/richdocuments/blob/main/docs/mobile_flow.md

To Reproduce
Steps to reproduce the behavior:

  1. check capabilities for available richdocuments:
$ curl -H "Authorization: Bearer [REMOVED]" "https://nextcloud.dev.vnc.de/ocs/v2.php/cloud/capabilities?format=json" | jq '.ocs.data.capabilities.richdocuments.version'
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 13495  100 13495    0     0  22728      0 --:--:-- --:--:-- --:--:-- 22718
"9.0.2"
$ 

So nextcloud has richdocuments enabled as expected.

  1. Try to get a link for a local file ( following https://github.com/nextcloud/richdocuments/blob/main/docs/mobile_editor.md )
$ curl -H "Content-Type: application/json" -H "Authorization: Bearer [REMOVED]" "https://nextcloud.dev.vnc.de/ocs/v2.php/apps/richdocuments/api/v1/document?format=json" --data-raw '{"fileid":"2696"}' | jq '.'
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   117  100   100  100    17    252     42 --:--:-- --:--:-- --:--:--   295
{
  "ocs": {
    "meta": {
      "status": "failure",
      "statuscode": 996,
      "message": "Internal Server Error\n"
    },
    "data": []
  }
}
$ 
  1. checked nextcloud.log:
{"reqId":"1pIE1dBotzdvQcPurPpn","level":3,"time":"2026-01-27T09:25:31+00:00","remoteAddr":"91.137.26.19","user":"316c9bc4668b590666a894632cd809d547c4f78160950544549bbf5b2cbbc9a6","app":"no app in context","method":"POST","url":"/ocs/v2.php/apps/richdocuments/api/v1/document?format=json","scriptName":"/ocs/v2.php","message":"OC\\Files\\Node\\Folder::getFirstNodeById(): Argument #1 ($id) must be of type int, null given, called in /var/www/html/custom_apps/richdocuments/lib/Controller/OCSController.php on line 66 in file '/var/www/html/lib/private/Files/Node/Folder.php' line 317","userAgent":"curl/8.5.0","version":"32.0.5.0","clientReqId":"d6a85a951d9784757158aaa1592cdfeb","exception":{"Exception":"Exception","Message":"OC\\Files\\Node\\Folder::getFirstNodeById(): Argument #1 ($id) must be of type int, null given, called in /var/www/html/custom_apps/richdocuments/lib/Controller/OCSController.php on line 66 in file '/var/www/html/lib/private/Files/Node/Folder.php' line 317","Code":0,"Trace":[{"file":"/var/www/html/lib/private/AppFramework/App.php","line":153,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Richdocuments\\Controller\\OCSController"},"createDirect"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":321,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Richdocuments\\Controller\\OCSController","createDirect",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"_route":"ocs.richdocuments.ocs.createdirect"}]},{"file":"/var/www/html/ocs/v1.php","line":61,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/ocsapp/apps/richdocuments/api/v1/document"]},{"file":"/var/www/html/ocs/v2.php","line":8,"args":["/var/www/html/ocs/v1.php"],"function":"require_once"}],"File":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","Line":150,"Previous":{"Exception":"TypeError","Message":"OC\\Files\\Node\\Folder::getFirstNodeById(): Argument #1 ($id) must be of type int, null given, called in /var/www/html/custom_apps/richdocuments/lib/Controller/OCSController.php on line 66","Code":0,"Trace":[{"file":"/var/www/html/custom_apps/richdocuments/lib/Controller/OCSController.php","line":66,"function":"getFirstNodeById","class":"OC\\Files\\Node\\Folder","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":204,"function":"createDirect","class":"OCA\\Richdocuments\\Controller\\OCSController","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":118,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Richdocuments\\Controller\\OCSController"},"createDirect"]},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":153,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Richdocuments\\Controller\\OCSController"},"createDirect"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":321,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Richdocuments\\Controller\\OCSController","createDirect",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"_route":"ocs.richdocuments.ocs.createdirect"}]},{"file":"/var/www/html/ocs/v1.php","line":61,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/ocsapp/apps/richdocuments/api/v1/document"]},{"file":"/var/www/html/ocs/v2.php","line":8,"args":["/var/www/html/ocs/v1.php"],"function":"require_once"}],"File":"/var/www/html/lib/private/Files/Node/Folder.php","Line":317},"message":"OC\\Files\\Node\\Folder::getFirstNodeById(): Argument #1 ($id) must be of type int, null given, called in /var/www/html/custom_apps/richdocuments/lib/Controller/OCSController.php on line 66 in file '/var/www/html/lib/private/Files/Node/Folder.php' line 317","exception":{},"CustomMessage":"OC\\Files\\Node\\Folder::getFirstNodeById(): Argument #1 ($id) must be of type int, null given, called in /var/www/html/custom_apps/richdocuments/lib/Controller/OCSController.php on line 66 in file '/var/www/html/lib/private/Files/Node/Folder.php' line 317"}}

Expected behavior

  • requesting a link for a document returns a usable link
  • it is possible to embed that link in another application

Client details:

  • OS: fwiw - ubuntu 24.04 / curl 8.5.0 for testing

Server details

nextcloud deployed from helm, using docker.io/library/nextcloud:32.0.5 with apache flavour

Nextcloud version: 32.0.5

Version of the richdocuments app: 9.0.2

Version of Collabora Online: 25.04.7.3

Configuration of the richdocuments app

$ kubectl exec -it nextcloud-5cbf848fc5-x2p9x -n nextcloud -- su -s /bin/sh www-data -c "php occ config:list richdocuments"
{
    "apps": {
        "richdocuments": {
            "public_wopi_url": "https:\/\/collabora.dev.vnc.de",
            "wopi_url": "https:\/\/collabora.dev.vnc.de",
            "installed_version": "9.0.2",
            "types": "filesystem,prevent_group_restriction",
            "enabled": "yes",
            "disable_certificate_verification": "",
            "doc_format": "ooxml",
            "wopi_allowlist": "0.0.0.0\/0",
            "canonical_webroot": "",
            "external_apps": "vnclagoon:lg99pr1szjjfw1gqj2qt,"
        }
    }
}
$ 

Logs
Nextcloud log (data/nextcloud.log)
{"reqId":"1pIE1dBotzdvQcPurPpn","level":3,"time":"2026-01-27T09:25:31+00:00","remoteAddr":"91.137.26.19","user":"316c9bc4668b590666a894632cd809d547c4f78160950544549bbf5b2cbbc9a6","app":"no app in context","method":"POST","url":"/ocs/v2.php/apps/richdocuments/api/v1/document?format=json","scriptName":"/ocs/v2.php","message":"OC\\Files\\Node\\Folder::getFirstNodeById(): Argument #1 ($id) must be of type int, null given, called in /var/www/html/custom_apps/richdocuments/lib/Controller/OCSController.php on line 66 in file '/var/www/html/lib/private/Files/Node/Folder.php' line 317","userAgent":"curl/8.5.0","version":"32.0.5.0","clientReqId":"d6a85a951d9784757158aaa1592cdfeb","exception":{"Exception":"Exception","Message":"OC\\Files\\Node\\Folder::getFirstNodeById(): Argument #1 ($id) must be of type int, null given, called in /var/www/html/custom_apps/richdocuments/lib/Controller/OCSController.php on line 66 in file '/var/www/html/lib/private/Files/Node/Folder.php' line 317","Code":0,"Trace":[{"file":"/var/www/html/lib/private/AppFramework/App.php","line":153,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Richdocuments\\Controller\\OCSController"},"createDirect"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":321,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Richdocuments\\Controller\\OCSController","createDirect",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"_route":"ocs.richdocuments.ocs.createdirect"}]},{"file":"/var/www/html/ocs/v1.php","line":61,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/ocsapp/apps/richdocuments/api/v1/document"]},{"file":"/var/www/html/ocs/v2.php","line":8,"args":["/var/www/html/ocs/v1.php"],"function":"require_once"}],"File":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","Line":150,"Previous":{"Exception":"TypeError","Message":"OC\\Files\\Node\\Folder::getFirstNodeById(): Argument #1 ($id) must be of type int, null given, called in /var/www/html/custom_apps/richdocuments/lib/Controller/OCSController.php on line 66","Code":0,"Trace":[{"file":"/var/www/html/custom_apps/richdocuments/lib/Controller/OCSController.php","line":66,"function":"getFirstNodeById","class":"OC\\Files\\Node\\Folder","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":204,"function":"createDirect","class":"OCA\\Richdocuments\\Controller\\OCSController","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":118,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Richdocuments\\Controller\\OCSController"},"createDirect"]},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":153,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Richdocuments\\Controller\\OCSController"},"createDirect"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":321,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Richdocuments\\Controller\\OCSController","createDirect",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"_route":"ocs.richdocuments.ocs.createdirect"}]},{"file":"/var/www/html/ocs/v1.php","line":61,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/ocsapp/apps/richdocuments/api/v1/document"]},{"file":"/var/www/html/ocs/v2.php","line":8,"args":["/var/www/html/ocs/v1.php"],"function":"require_once"}],"File":"/var/www/html/lib/private/Files/Node/Folder.php","Line":317},"message":"OC\\Files\\Node\\Folder::getFirstNodeById(): Argument #1 ($id) must be of type int, null given, called in /var/www/html/custom_apps/richdocuments/lib/Controller/OCSController.php on line 66 in file '/var/www/html/lib/private/Files/Node/Folder.php' line 317","exception":{},"CustomMessage":"OC\\Files\\Node\\Folder::getFirstNodeById(): Argument #1 ($id) must be of type int, null given, called in /var/www/html/custom_apps/richdocuments/lib/Controller/OCSController.php on line 66 in file '/var/www/html/lib/private/Files/Node/Folder.php' line 317"}}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with docs/mobile_flow.md and docs/mobile_editor.md, then inspect OCSController.php at line 66 for the createDirect endpoint called by /ocs/v2.php/apps/richdocuments/api/v1/document. Reproduce the documented curl request and compare its fileid handling with the logged null argument. Done means the endpoint returns a usable document link that can be embedded in another application.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, helm, kubernetes, php
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.