nextcloud / nextcloud/backup

S3 upload fails with Argument #1 ($user) must be of type OCP\IUser, null given

Open
#434 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
272
Forks
37
PR merge metrics
No merged PRs in 30d

Description

I can't upload backup archive (packed,compressed,encrypted) to s3, that is mounted as external storage and accessible in files interface. Folders are successfully created on s3, but files upload fails. Looks it tries to upload with a user owner in metadata, as seen in error message, that is inexistant as called from CLI.

NC 24.0.6 with official docker image. Backup 1.1.3.

$ ./occ backup:point:upload 20221018174455-full-xxxx --remote="amazon::external::xxxxxxxxxxxxxxxxxxxxxxxxxxx" -vvv
- uploading 20221018174455-full-xxxx to external folders
 - checking external folder 26:ncc
  > restoring point not found
  * Creating Restoring Point on external folder: ok
  > restoring point created
  * initiating health check
An unhandled exception has been thrown:
TypeError: OCA\Files_Versions\Versions\VersionManager::createVersion(): Argument #1 ($user) must be of type OCP\IUser, null given, called in /var/www/html/apps/files_versions/lib/Storage.php on line 230 and defined in /var/www/html/apps/files_versions/lib/Versions/VersionManager.php:90
Stack trace:
#0 /var/www/html/apps/files_versions/lib/Storage.php(230): OCA\Files_Versions\Versions\VersionManager->createVersion(NULL, Object(OC\Files\Node\File))
#1 /var/www/html/apps/files_versions/lib/Hooks.php(56): OCA\Files_Versions\Storage::store('/backups3bis/nc...')
#2 /var/www/html/lib/private/legacy/OC_Hook.php(106): OCA\Files_Versions\Hooks::write_hook(Array)
#3 /var/www/html/lib/private/Files/View.php(1290): OC_Hook::emit('OC_Filesystem', 'write', Array)
#4 /var/www/html/lib/private/Files/View.php(1160): OC\Files\View->runHooks(Array, '/backups3bis/nc...')
#5 /var/www/html/lib/private/Files/View.php(711): OC\Files\View->basicOperation('file_put_conten...', '/jeremy/files/bac...', Array, '{\n    "id": "20...')
#6 /var/www/html/lib/private/Files/Node/File.php(71): OC\Files\View->file_put_contents('/jeremy/files/bac...', '{\n    "id": "20...')
#7 /var/www/html/custom_apps/backup/lib/Service/ExternalFolderService.php(223): OC\Files\Node\File->putContent('{\n    "id": "20...')
#8 /var/www/html/custom_apps/backup/lib/Service/ExternalFolderService.php(388): OCA\Backup\Service\ExternalFolderService->getRestoringPoint(Object(OCA\Backup\Model\ExternalFolder), '20221018174455-...', true)
#9 /var/www/html/custom_apps/backup/lib/Service/UploadService.php(318): OCA\Backup\Service\ExternalFolderService->confirmPoint(Object(OCA\Backup\Model\ExternalFolder), Object(OCA\Backup\Model\RestoringPoint))
#10 /var/www/html/custom_apps/backup/lib/Command/PointUpload.php(129): OCA\Backup\Service\UploadService->uploadToExternalFolder(Object(OCA\Backup\Model\RestoringPoint), 0)
#11 /var/www/html/3rdparty/symfony/console/Command/Command.php(255): OCA\Backup\Command\PointUpload->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 /var/www/html/core/Command/Base.php(168): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 /var/www/html/3rdparty/symfony/console/Application.php(1009): OC\Core\Command\Base->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 /var/www/html/3rdparty/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(OCA\Backup\Command\PointUpload), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 /var/www/html/3rdparty/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 /var/www/html/lib/private/Console/Application.php(211): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 /var/www/html/console.php(100): OC\Console\Application->run()
#18 /var/www/html/occ(11): require_once('/var/www/html/c...')
#19 {main}

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

Reproduce with the provided occ backup:point:upload command, then inspect apps/files_versions/lib/Storage.php around line 230 and lib/Versions/VersionManager.php around line 90. Trace the call from custom_apps/backup/lib/Service/ExternalFolderService.php line 223 and verify that uploading a backup to the S3 external folder completes without the null IUser TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, php
Domain
backend, cli, cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.