pulsejet / memories

Fast, modern and advanced photo management suite. Runs as a Nextcloud app.
https://memories.gallery
GNU Affero General Public License v3.0
3.22k stars 87 forks source link

StorageInvalidException: Sabre\HTTP\ClientHttpException: Unauthorized #1187

Open simonspa opened 6 months ago

simonspa commented 6 months ago

Describe the bug

In the Nextcloud logger I see many entries of Memories trying to index a folder that is a share from a remote Nextcloud server. According to the error message, it does not seem to be able to access the folder. Curiously, there is no issue when accessing it via the Files app and all content can be accessed and displayed.

See errors below.

To Reproduce Receive a federated share from a remote Nextcloud server, observe errors by Memories in Nextcloud log.

Platform:

Additional context Nextcloud server log errors:

{
    "reqId": "7ltsAUNDVwVMu4W1QQUB",
    "level": 3,
    "time": "2024-05-12T21:25:18+02:00",
    "remoteAddr": "",
    "user": "--",
    "app": "memories",
    "method": "",
    "url": "--",
    "message": "Failed to index folder /path/to/shared/folder: ",
    "userAgent": "--",
    "version": "28.0.5.1",
    "data":
    {
        "app": "memories"
    },
    "id": "6641199fca0b7"
}

ANd right before that, the SabreDAV warning log entry:

{
    "reqId": "7ltsAUNDVwVMu4W1QQUB",
    "level": 2,
    "time": "2024-05-12T21:25:18+02:00",
    "remoteAddr": "",
    "user": "--",
    "app": "no app in context",
    "method": "",
    "url": "--",
    "message": "External storage not available: Sabre\\HTTP\\ClientHttpException: Unauthorized",
    "userAgent": "--",
    "version": "28.0.5.1",
    "exception":
    {
        "Exception": "OCP\\Files\\StorageInvalidException",
        "Message": "Sabre\\HTTP\\ClientHttpException: Unauthorized",
        "Code": 0,
        "Trace":
        [
            {
                "file": "/var/www/nextcloud/lib/private/Files/Storage/DAV.php",
                "line": 298,
                "function": "convertException",
                "class": "OC\\Files\\Storage\\DAV",
                "type": "->",
                "args":
                [
                    [
                        "Sabre\\HTTP\\ClientHttpException"
                    ],
                    ""
                ]
            },
            {
                "file": "/var/www/nextcloud/lib/private/Files/Storage/DAV.php",
                "line": 600,
                "function": "propfind",
                "class": "OC\\Files\\Storage\\DAV",
                "type": "->",
                "args":
                [
                    ""
                ]
            },
            {
                "file": "/var/www/nextcloud/lib/private/Files/Storage/DAV.php",
                "line": 660,
                "function": "getMetaData",
                "class": "OC\\Files\\Storage\\DAV",
                "type": "->",
                "args":
                [
                    ""
                ]
            },
            {
                "file": "/var/www/nextcloud/lib/private/Files/Storage/Common.php",
                "line": 466,
                "function": "stat",
                "class": "OC\\Files\\Storage\\DAV",
                "type": "->",
                "args":
                [
                    ""
                ]
            },
            {
                "file": "/var/www/nextcloud/apps/files_sharing/lib/External/Storage.php",
                "line": 213,
                "function": "test",
                "class": "OC\\Files\\Storage\\Common",
                "type": "->",
                "args":
                []
            },
            {
                "file": "/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php",
                "line": 480,
                "function": "test",
                "class": "OCA\\Files_Sharing\\External\\Storage",
                "type": "->",
                "args":
                []
            },
            {
                "file": "/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Availability.php",
                "line": 69,
                "function": "test",
                "class": "OC\\Files\\Storage\\Wrapper\\Wrapper",
                "type": "->",
                "args":
                []
            },
            {
                "file": "/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Availability.php",
                "line": 83,
                "function": "updateAvailability",
                "class": "OC\\Files\\Storage\\Wrapper\\Availability",
                "type": "->",
                "args":
                [
                    "*** sensitive parameters replaced ***"
                ]
            },
            {
                "file": "/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Availability.php",
                "line": 92,
                "function": "isAvailable",
                "class": "OC\\Files\\Storage\\Wrapper\\Availability",
                "type": "->",
                "args":
                []
            },
            {
                "file": "/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Availability.php",
                "line": 242,
                "function": "checkAvailability",
                "class": "OC\\Files\\Storage\\Wrapper\\Availability",
                "type": "->",
                "args":
                []
            },
            {
                "file": "/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php",
                "line": 233,
                "function": "file_exists",
                "class": "OC\\Files\\Storage\\Wrapper\\Availability",
                "type": "->",
                "args":
                [
                    ".nomedia"
                ]
            },
            {
                "file": "/var/www/nextcloud/lib/private/Files/View.php",
                "line": 1332,
                "function": "file_exists",
                "class": "OC\\Files\\Storage\\Wrapper\\Wrapper",
                "type": "->",
                "args":
                [
                    ".nomedia"
                ]
            },
            {
                "file": "/var/www/nextcloud/lib/private/Files/View.php",
                "line": 1376,
                "function": "getCacheEntry",
                "class": "OC\\Files\\View",
                "type": "->",
                "args":
                [
                    [
                        "OCA\\Files_Trashbin\\Storage",
                        null,
                        null,
                        null,
                        null,
                        null
                    ],
                    ".nomedia",
                    "/path/to/shared/folder/.nomedia"
                ]
            },
            {
                "file": "/var/www/nextcloud/lib/private/Files/Node/Root.php",
                "line": 203,
                "function": "getFileInfo",
                "class": "OC\\Files\\View",
                "type": "->",
                "args":
                [
                    "/path/to/shared/folder/.nomedia",
                    false
                ]
            },
            {
                "file": "/var/www/nextcloud/lib/private/Files/Node/Folder.php",
                "line": 135,
                "function": "get",
                "class": "OC\\Files\\Node\\Root",
                "type": "->",
                "args":
                [
                    "/path/to/shared/folder/.nomedia"
                ]
            },
            {
                "file": "/var/www/nextcloud/lib/private/Files/Node/Folder.php",
                "line": 144,
                "function": "get",
                "class": "OC\\Files\\Node\\Folder",
                "type": "->",
                "args":
                [
                    ".nomedia"
                ]
            },
            {
                "file": "/var/www/nextcloud/apps/memories/lib/Service/Index.php",
                "line": 142,
                "function": "nodeExists",
                "class": "OC\\Files\\Node\\Folder",
                "type": "->",
                "args":
                [
                    ".nomedia"
                ]
            },
            {
                "file": "/var/www/nextcloud/apps/memories/lib/Service/Index.php",
                "line": 215,
                "function": "indexFolder",
                "class": "OCA\\Memories\\Service\\Index",
                "type": "->",
                "args":
                [
                    [
                        "OC\\Files\\Node\\Folder"
                    ]
                ]
            },
            {
                "file": "/var/www/nextcloud/apps/memories/lib/Service/Index.php",
                "line": 215,
                "function": "indexFolder",
                "class": "OCA\\Memories\\Service\\Index",
                "type": "->",
                "args":
                [
                    [
                        "OC\\Files\\Node\\Folder"
                    ]
                ]
            },
            {
                "file": "/var/www/nextcloud/apps/memories/lib/Service/Index.php",
                "line": 120,
                "function": "indexFolder",
                "class": "OCA\\Memories\\Service\\Index",
                "type": "->",
                "args":
                [
                    [
                        "OC\\Files\\Node\\Folder"
                    ]
                ]
            },
            {
                "file": "/var/www/nextcloud/apps/memories/lib/Cron/IndexJob.php",
                "line": 92,
                "function": "indexUser",
                "class": "OCA\\Memories\\Service\\Index",
                "type": "->",
                "args":
                [
                    "*** sensitive parameters replaced ***"
                ]
            },
            {
                "file": "/var/www/nextcloud/lib/private/User/Manager.php",
                "line": 656,
                "function": "OCA\\Memories\\Cron\\{closure}",
                "class": "OCA\\Memories\\Cron\\IndexJob",
                "type": "->",
                "args":
                [
                    "*** sensitive parameters replaced ***"
                ]
            },
            {
                "file": "/var/www/nextcloud/apps/memories/lib/Cron/IndexJob.php",
                "line": 90,
                "function": "callForSeenUsers",
                "class": "OC\\User\\Manager",
                "type": "->",
                "args":
                [
                    [
                        "Closure"
                    ]
                ]
            },
            {
                "file": "/var/www/nextcloud/apps/memories/lib/Cron/IndexJob.php",
                "line": 63,
                "function": "indexAllUsers",
                "class": "OCA\\Memories\\Cron\\IndexJob",
                "type": "->",
                "args":
                []
            },
            {
                "file": "/var/www/nextcloud/lib/public/BackgroundJob/Job.php",
                "line": 81,
                "function": "run",
                "class": "OCA\\Memories\\Cron\\IndexJob",
                "type": "->",
                "args":
                [
                    null
                ]
            },
            {
                "file": "/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php",
                "line": 102,
                "function": "start",
                "class": "OCP\\BackgroundJob\\Job",
                "type": "->",
                "args":
                [
                    [
                        "OC\\BackgroundJob\\JobList"
                    ]
                ]
            },
            {
                "file": "/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php",
                "line": 92,
                "function": "start",
                "class": "OCP\\BackgroundJob\\TimedJob",
                "type": "->",
                "args":
                [
                    [
                        "OC\\BackgroundJob\\JobList"
                    ]
                ]
            },
            {
                "file": "/var/www/nextcloud/cron.php",
                "line": 152,
                "function": "execute",
                "class": "OCP\\BackgroundJob\\TimedJob",
                "type": "->",
                "args":
                [
                    [
                        "OC\\BackgroundJob\\JobList"
                    ],
                    [
                        "OC\\Log"
                    ]
                ]
            }
        ],
        "File": "/var/www/nextcloud/lib/private/Files/Storage/DAV.php",
        "Line": 881,
        "message": "External storage not available: Sabre\\HTTP\\ClientHttpException: Unauthorized",
        "exception":
        [],
        "CustomMessage": "External storage not available: Sabre\\HTTP\\ClientHttpException: Unauthorized"
    },
    "id": "6641199fca2d1"
}
akaro1 commented 5 months ago

how to fix ???

Exception during scan: Sabre\HTTP\ClientHttpException: Unauthorized

at -> This Nextcloud is on version 29.0.2 Linux server 5.17.9-051709-generic #202205180947 SMP PREEMPT Wed May 18 10:14:10 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux -> PHP 8.1.2-1ubuntu2.17

0 /var/www/nextcloud/lib/private/Files/Storage/DAV.php(298): OC\Files\Storage\DAV->convertException()

1 /var/www/nextcloud/lib/private/Files/Storage/DAV.php(339): OC\Files\Storage\DAV->propfind()

2 /var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php(233): OC\Files\Storage\DAV->file_exists()

3 /var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php(233): OC\Files\Storage\Wrapper\Wrapper->file_exists()

4 /var/www/nextcloud/lib/private/Files/Utils/Scanner.php(268): OC\Files\Storage\Wrapper\Wrapper->file_exists()

5 /var/www/nextcloud/apps/files/lib/Command/Scan.php(180): OC\Files\Utils\Scanner->scan()

6 /var/www/nextcloud/apps/files/lib/Command/Scan.php(241): OCA\Files\Command\Scan->scanFiles()

7 /var/www/nextcloud/3rdparty/symfony/console/Command/Command.php(298): OCA\Files\Command\Scan->execute()

8 /var/www/nextcloud/core/Command/Base.php(177): Symfony\Component\Console\Command\Command->run()

9 /var/www/nextcloud/3rdparty/symfony/console/Application.php(1040): OC\Core\Command\Base->run()

10 /var/www/nextcloud/3rdparty/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand()

11 /var/www/nextcloud/3rdparty/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun()

12 /var/www/nextcloud/lib/private/Console/Application.php(213): Symfony\Component\Console\Application->run()

13 /var/www/nextcloud/console.php(102): OC\Console\Application->run()

14 /var/www/nextcloud/occ(11): require_once('...')

15 {main}