Nextcloud share file node cannot find file

Describe the issue/error/question

I’m trying to run a really simple workflow that reads a file from disk, uploads it to Nextcloud and then shares that file on Nextcloud.

I must have spent four hours on this yesterday, most of it scratching my head because it should be quite simple, but for whatever reason the share node returns a not found error.

A few things stick out to me - firstly, even if ‘Always Output Data’ is set no the file upload node, there is no data passed through that node. I wasn’t sure if this was expected behaviour, and it doesn’t seem to affect other file operations after the Nextcloud node (such as downloading the file in question). However, instead of referencing input data outputted from the upload node, I have to use the file path output from the read binary file node in order to reference the file correctly.

What is the error message (if any)?

The resource you are requesting could not be found

Please share the workflow

Share the output returned by the last node

{"message":"404 - \"<?xml version=\\\"1.0\\\" encoding=\\\"utf-8\\\"?>\\n<d:error xmlns:d=\\\"DAV:\\\" xmlns:s=\\\"http://sabredav.org/ns\\\">\\n <s:exception>Sabre\\\\DAV\\\\Exception\\\\NotFound</s:exception>\\n <s:message>File not found: ocs in 'root'</s:message>\\n</d:error>\\n\"","name":"Error","stack":"Error: Request failed with status code 404\n at createError (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/createError.js:16:15)\n at settle (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/settle.js:17:12)\n at IncomingMessage.handleStreamEnd (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/adapters/http.js:269:11)\n at IncomingMessage.emit (node:events:539:35)\n at endReadableNT (node:internal/streams/readable:1345:12)\n at processTicksAndRejections (node:internal/process/task_queues:83:21)"}

Information on your n8n setup

  • n8n version:
  • Database you’re using (default: SQLite):
  • Running n8n with the execution process [own(default), main]:
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]:

Very strange. Looks correct, also just tested and worked fine for me. Did however also try with authentication method “Access Token” as I do not have one with “OAuth2” set up.

There it worked without a problem (can confirm that there is no output in the node that uploads the data, but that is fine). So maybe is worth trying to test with the other authentication method.

I drew the same conclusion before posting as I figured it may need a user account association in order to create a share, but it doesn’t behave any differently.

Thanks for testing - you’ve kinda confirmed my suspicions that this is probably an issue Nextcloud side, so I’ll do a bit of digging that end.

Cheers!

I have the same problem. Any updates is appreciated.

I have same problem, cannot create share, It says cannot find folder even though I use the file path from listing results

Hi @No_Name and @Hugh, can you guys confirm which versions of n8n and Nextcloud you were running when encountering this issue? Also, how did you authenticate with Nextcloud? Thanks!

I’m using the latest version of N8N (0.189.0) and Next Cloud (24.0.3). Both of the instances are deployed using Docker. They are behind a reverse proxy.

Error when using Access Token

   "context":{
   },
   "name":"NodeApiError",
   "cause":{
      "message":"404 - \"<?xml version=\\\"1.0\\\" encoding=\\\"utf-8\\\"?>\\n<d:error xmlns:d=\\\"DAV:\\\" xmlns:s=\\\"http://sabredav.org/ns\\\">\\n  <s:exception>Sabre\\\\DAV\\\\Exception\\\\NotFound</s:exception>\\n  <s:message>File with name //ocs could not be located</s:message>\\n</d:error>\\n\"",
      "name":"Error",
      "stack":"Error: Request failed with status code 404\n    at createError (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/createError.js:16:15)\n    at settle (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/settle.js:17:12)\n    at IncomingMessage.handleStreamEnd (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/adapters/http.js:269:11)\n    at IncomingMessage.emit (node:events:539:35)\n    at endReadableNT (node:internal/streams/readable:1345:12)\n    at processTicksAndRejections (node:internal/process/task_queues:83:21)"
   },
   "timestamp":1659649827973,
   "message":"The resource you are requesting could not be found",
   "node":{
      "parameters":{
         "authentication":"accessToken",
         "resource":"folder",
         "operation":"share",
         "path":"/ABC-DEF/2000-test",
         "shareType":3,
         "options":{
            "permissions":31
         }
      },
      "id":"05a57538-9304-4155-9f2c-e1c0349f380a",
      "name":"Nextcloud4",
      "type":"n8n-nodes-base.nextCloud",
      "typeVersion":1,
      "position":[
         840,
         240
      ],
      "alwaysOutputData":true,
      "credentials":{
         "nextCloudApi":{
            "id":"1",
            "name":"___________.com"
         }
      },
      "notes":"Share filedrop"
   },
   "httpCode":"404",
   "description":null
}

I don’t have a working setup with OAuth.

How I solved my problem;

I created two authentication option for nexcloud node.
One is to upload and create content on your server
Authentication url must be: https://nexcloud.example.com/remote.php/dav/files/USERNAME/

To create a share, URL must be https://nexcloud.example.com/
That’s it

2 Likes

Thank you so much. I got it working by setting up a second Basic Token authentication.

@MutedJam

2 Likes

Oh boy, that is very much unexpected. Thanks so much for confirming and sharing your workaround, I’ll make sure to add this to our internal bug tracker for a closer look!

1 Like

Thought I might share another bug with this module. When creating a public share with “all” permission, the generated link is still read only. I think it is so because publicUpload is unset.

https://docs.nextcloud.com/server/latest/developer_manual/client_apis/OCS/ocs-share-api.html