Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Error: Call to undefined function GuzzleHttp\Psr7\stream_for() runing SWIFT Object Storage as Primary storage #31712

Closed
5 of 8 tasks
Lejo1 opened this issue Mar 25, 2022 · 18 comments · Fixed by #36879
Closed
5 of 8 tasks
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap 25-feedback bug

Comments

@Lejo1
Copy link

Lejo1 commented Mar 25, 2022

⚠️ 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 (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

The nextcloud:stable-fpm-alpine docker image just upgraded to 22.2.6.2 after recreation of the container I've got the attached error message and the server went into maintenance mode.
Manual upgrade using php occ upgrade resulted in the same error

Steps to reproduce

  1. Upgrade your Nextcloud from 22.2.5 with a SWIFT Object Storage as Primary storage to 22.2.6

Expected behavior

The automated update to pass

Installation method

Official Docker image

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.0

Web server

Nginx

Database engine version

MySQL

Is this bug present after an update or on a fresh install?

Updated from a minor version (ex. 22.2.3 to 22.2.4)

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

{
    "system": {
        "memcache.local": "\\OC\\Memcache\\APCu",
        "apps_paths": [
            {
                "path": "\/var\/www\/html\/apps",
                "url": "\/apps",
                "writable": false
            },
            {
                "path": "\/var\/www\/html\/custom_apps",
                "url": "\/custom_apps",
                "writable": true
            }
        ],
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "nexxxt.cloud",
            "web"
        ],
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "22.2.5.1",
        "overwrite.cli.url": "http:\/\/nexxxt.cloud",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "mail_smtpmode": "smtp",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_sendmailmode": "smtp",
        "overwriteprotocol": "https",
        "maintenance": true,
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "password": "***REMOVED SENSITIVE VALUE***",
            "port": 6379
        },
        "loglevel": 0,
        "theme": "",
        "allow_local_remote_servers": true,
        "objectstore": {
            "class": "OC\\Files\\ObjectStore\\Swift",
            "arguments": {
                "autocreate": false,
                "user": {
                    "name": "***REMOVED SENSITIVE VALUE***",
                    "password": "***REMOVED SENSITIVE VALUE***",
                    "domain": {
                        "name": "Default"
                    }
                },
                "scope": {
                    "project": {
                        "name": "8984310712731365",
                        "domain": {
                            "name": "Default"
                        }
                    }
                },
                "serviceName": "swift",
                "region": "DE",
                "url": "https:\/\/auth.cloud.ovh.net\/v3",
                "bucket": "Nextcloud"
            }
        },
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "25"
    }
}

List of activated Apps

Enabled:
  - accessibility: 1.8.0
  - calendar: 3.2.2
  - circles: 22.3.0
  - cloud_federation_api: 1.5.0
  - comments: 1.12.0
  - contacts: 4.1.0
  - dashboard: 7.2.0
  - dav: 1.20.0
  - deck: 1.5.6
  - end_to_end_encryption: 1.8.1
  - federatedfilesharing: 1.12.0
  - federation: 1.12.0
  - files: 1.17.0
  - files_external: 1.13.1
  - files_mindmap: 0.0.26
  - files_pdfviewer: 2.3.1
  - files_rightclick: 1.1.0
  - files_sharing: 1.14.0
  - files_trashbin: 1.12.0
  - files_versions: 1.15.0
  - files_videoplayer: 1.11.0
  - firstrunwizard: 2.11.0
  - integration_moodle: 1.0.2
  - logreader: 2.7.0
  - lookup_server_connector: 1.10.0
  - nextcloud_announcements: 1.11.0
  - notifications: 2.10.1
  - notify_push: 0.3.0
  - oauth2: 1.10.0
  - onlyoffice: 7.3.2
  - password_policy: 1.12.0
  - photos: 1.4.0
  - privacy: 1.6.0
  - provisioning_api: 1.12.0
  - quota_warning: 1.13.1
  - recommendations: 1.1.0
  - serverinfo: 1.12.0
  - settings: 1.4.0
  - sharebymail: 1.12.0
  - spreed: 12.2.4
  - support: 1.5.0
  - survey_client: 1.10.0
  - systemtags: 1.12.0
  - tasks: 0.14.4
  - text: 3.3.1
  - theming: 1.13.0
  - twofactor_backupcodes: 1.11.0
  - updatenotification: 1.12.0
  - user_status: 1.2.0
  - viewer: 1.6.0
  - weather_status: 1.2.0
  - workflowengine: 2.4.0
Disabled:
  - activity: 2.12.1
  - admin_audit
  - contactsinteraction: 1.3.0
  - encryption: 2.8.1
  - user_ldap

Nextcloud Signing status

No response

Nextcloud Logs

No response

Additional info

I'm using the OVH Object Storage using the SWIFT endpoint

That's the error I've got on trying to upgrade:

You may use your browser or the occ upgrade command to do the upgrade
Setting log level to debug
Updating database schema
Updated database
An unhandled exception has been thrown:
Error: Call to undefined function GuzzleHttp\Psr7\stream_for() in /var/www/html/lib/private/Files/ObjectStore/Swift.php:84
Stack trace:
#0 /var/www/html/lib/private/Files/ObjectStore/ObjectStoreStorage.php(495): OC\Files\ObjectStore\Swift->writeObject('urn:oid:34246', Resource id #1210, 'application/jso...')
#1 /var/www/html/lib/private/Files/ObjectStore/ObjectStoreStorage.php(424): OC\Files\ObjectStore\ObjectStoreStorage->writeStream('appdata_ocupsro...', Resource id #1210, 2009240)
#2 /var/www/html/lib/private/Files/ObjectStore/ObjectStoreStorage.php(337): OC\Files\ObjectStore\ObjectStoreStorage->writeBack('/tmp/oc_tmp_pHN...', 'appdata_ocupsro...')
#3 [internal function]: OC\Files\ObjectStore\ObjectStoreStorage->OC\Files\ObjectStore\{closure}()
#4 /var/www/html/apps/files_external/3rdparty/icewind/streams/src/CallbackWrapper.php(119): call_user_func(Object(Closure))
#5 [internal function]: Icewind\Streams\CallbackWrapper->stream_close()
#6 /var/www/html/lib/private/Files/ObjectStore/ObjectStoreStorage.php(445): fclose(Resource id #1209)
#7 /var/www/html/lib/private/Files/Storage/Wrapper/Wrapper.php(258): OC\Files\ObjectStore\ObjectStoreStorage->file_put_contents('appdata_ocupsro...', '{"data":[{"id":...')
#8 /var/www/html/lib/private/Files/Storage/Wrapper/Availability.php(274): OC\Files\Storage\Wrapper\Wrapper->file_put_contents('appdata_ocupsro...', '{"data":[{"id":...')
#9 /var/www/html/lib/private/Files/Storage/Wrapper/Wrapper.php(258): OC\Files\Storage\Wrapper\Availability->file_put_contents('appdata_ocupsro...', '{"data":[{"id":...')
#10 /var/www/html/lib/private/Files/View.php(1169): OC\Files\Storage\Wrapper\Wrapper->file_put_contents('appdata_ocupsro...', '{"data":[{"id":...')
#11 /var/www/html/lib/private/Files/View.php(706): OC\Files\View->basicOperation('file_put_conten...', '/appdata_ocupsr...', Array, '{"data":[{"id":...')
#12 /var/www/html/lib/private/Files/Node/File.php(71): OC\Files\View->file_put_contents('/appdata_ocupsr...', '{"data":[{"id":...')
#13 /var/www/html/lib/private/Files/SimpleFS/SimpleFile.php(108): OC\Files\Node\File->putContent('{"data":[{"id":...')
#14 /var/www/html/lib/private/App/AppStore/Fetcher/Fetcher.php(191): OC\Files\SimpleFS\SimpleFile->putContent('{"data":[{"id":...')
#15 /var/www/html/lib/private/Installer.php(432): OC\App\AppStore\Fetcher\Fetcher->get(false)
#16 /var/www/html/lib/private/Updater.php(427): OC\Installer->isUpdateAvailable('accessibility')
#17 /var/www/html/lib/private/Updater.php(273): OC\Updater->upgradeAppStoreApps(Array)
#18 /var/www/html/lib/private/Updater.php(132): OC\Updater->doUpgrade('22.2.6.2', '22.2.5.1')
#19 /var/www/html/core/Command/Upgrade.php(235): OC\Updater->upgrade()
#20 /var/www/html/3rdparty/symfony/console/Command/Command.php(255): OC\Core\Command\Upgrade->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#21 /var/www/html/3rdparty/symfony/console/Application.php(1009): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 /var/www/html/3rdparty/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(OC\Core\Command\Upgrade), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#23 /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))
#24 /var/www/html/lib/private/Console/Application.php(209): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#25 /var/www/html/console.php(99): OC\Console\Application->run()
#26 /var/www/html/occ(11): require_once('/var/www/html/c...')
#27 {main}```
@Lejo1 Lejo1 added 0. Needs triage Pending check for reproducibility or if it fits our roadmap bug labels Mar 25, 2022
@solracsf solracsf changed the title [Bug]: Upgrade from 22.2.5.1 to 22.2.6.2 with SWIFT Object Storage as Primary failed [Bug]: Error: Call to undefined function GuzzleHttp\Psr7\stream_for() Mar 25, 2022
@solracsf solracsf changed the title [Bug]: Error: Call to undefined function GuzzleHttp\Psr7\stream_for() [Bug]: Error: Call to undefined function GuzzleHttp\Psr7\stream_for() runing SWIFT Object Storage as Primary storage Mar 25, 2022
@william-billaud
Copy link

Running in the same problem as you and commit 66bdda5 resolved most of the problem (I still need to patch https://github.com/nextcloud/3rdparty/blob/master/php-opencloud/openstack/src/Common/Auth/AuthHandler.php manually).

@solracsf
Copy link
Member

@come-nc should 66bdda5 be backported?

@solracsf
Copy link
Member

This will be needed too nextcloud/3rdparty#911

@Lejo1
Copy link
Author

Lejo1 commented Mar 27, 2022

I've just applied 66bdda5 and php-opencloud/openstack@8a6a6a7 from nextcloud/3rdparty#911
The updated now worked, I just had to manually disable the maintance mode

@come-nc
Copy link
Contributor

come-nc commented Mar 28, 2022

@come-nc should 66bdda5 be backported?

I’m not sure, it depends how dependencies are handled on each version. Should Nextcloud 22.X depend upon Guzzle 2?

@vaelu
Copy link

vaelu commented Dec 9, 2022

I just had this error when I tried updating from 25.0.1 to 25.0.2 with OpenStack Swift as primary storage. Really strange, since this was fixed in 66bdda5. Now, my instance says integrity check failed for AuthHandler.php.

@fcrespel
Copy link

fcrespel commented Dec 9, 2022

Same here with 25.0.2, it seems php-opencloud/openstack version 3.1.0 is not compatible with guzzlehttp/psr7 2.x (it was with 1.x in NC 25.0.1), and now needs to be updated to version 3.2.1.

Until this is fixed, here are some emergency workaround commands to patch the file and finish the upgrade, assuming Nextcloud is in /var/www/html:

sed -ri -e 's#use function GuzzleHttp\\Psr7\\modify_request;#use GuzzleHttp\\Psr7\\Utils;#g' -e 's#modify_request#Utils::modifyRequest#g' /var/www/html/3rdparty/php-opencloud/openstack/src/Common/Auth/AuthHandler.php
/var/www/html/occ upgrade
/var/www/html/occ maintenance:mode --off

@Lejo1
Copy link
Author

Lejo1 commented Dec 9, 2022

@fcrespel
Can confirm just got the same error after upgrading to 25.0.2.3
Thanks for the workaround!

@rfilmyer
Copy link

rfilmyer commented Dec 12, 2022

Looks like we have outstanding PRs for master, v23, v24, and v25 that got auto-submitted by dependabot

@maxcco
Copy link

maxcco commented Dec 12, 2022

just run into this problem with the latest release 25.0.2

@fcrespel thank you for the trick

@tkarra
Copy link

tkarra commented Jan 2, 2023

another emergency workaround for snap users : revert to previous version :
sudo snap revert nextcloud

@szaimen
Copy link
Contributor

szaimen commented Jan 23, 2023

Hi, please update to 24.0.9 or better 25.0.3 and report back if it fixes the issue. Thank you!

My goal is to add a label like e.g. 25-feedback to this ticket of an up-to-date major Nextcloud version where the bug could be reproduced. However this is not going to work without your help. So thanks for all your effort!

If you don't manage to reproduce the issue in time and the issue gets closed but you can reproduce the issue afterwards, feel free to create a new bug report with up-to-date information by following this link: https://github.com/nextcloud/server/issues/new?assignees=&labels=bug%2C0.+Needs+triage&template=BUG_REPORT.yml&title=%5BBug%5D%3A+

@Lejo1
Copy link
Author

Lejo1 commented Jan 23, 2023

I’ve updated to 25.0.3 a few days ago. The same problem occurred again and I had to apply this workaround again.

@mirtouf
Copy link

mirtouf commented Jan 28, 2023

I confirm the trick from @fcrespel was helpful and update to release 25.0.3 did not cure the issue.

@maxcco
Copy link

maxcco commented Feb 23, 2023

Could reproduce today again when upgrading to 25.0.4

@sandrolf
Copy link

it also happens when updating Nextcloud Enterprise from 25.0.3 to 25.0.4

@vaelu
Copy link

vaelu commented Apr 27, 2023

Since #36879 was merged, is it now safe to update to 25.0.6 without breaking the installation?

@jhass
Copy link

jhass commented May 17, 2023

25.0.6 is working for me without the patch 🎉

@come-nc come-nc closed this as completed May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap 25-feedback bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.