Error while creating Share on federated Instance

Nextcloud version (eg, 20.0.5): 25.0.2
Operating system and version (eg, Ubuntu 20.04): Debian 11.6
Apache or nginx version (eg, Apache 2.4.25): nginx 1.18.0
PHP version (eg, 7.4): 8.1

The issue you are facing:
When sharing from my main cloud to the federated one, the shares work fine. When I try to create a link share on the federated one, I get the error “Error while creating the share”

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. Share from Main-Nextcloud-Instance to Secondary-NC-Instance
  2. Try to create a Link-Share on the Secondary-NC-Instance
  3. Get the error

The output of your Nextcloud log in Admin > Logging:

Exception: call_user_func_array(): Argument #1 ($callback) must be a valid callback, class OCA\Files_Sharing\External\Storage does not have a method "getShareId" in file '/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php' line 527

    /var/www/nextcloud/lib/private/AppFramework/App.php - line 172:

    OC\AppFramework\Http\Dispatcher->dispatch()

    /var/www/nextcloud/lib/private/Route/Router.php - line 298:

    OC\AppFramework\App::main()

    /var/www/nextcloud/ocs/v1.php - line 63:

    OC\Route\Router->match()

    /var/www/nextcloud/ocs/v2.php - line 23:

    require_once("/var/www/nextcloud/ocs/v1.php")

Verursacht durch TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback, class OCA\Files_Sharing\External\Storage does not have a method "getShareId"

    /var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php - line 527:

    call_user_func_array()

    <<closure>>

    OC\Files\Storage\Wrapper\Wrapper->__call()

    /var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php - line 527:

    call_user_func_array()

    /var/www/nextcloud/lib/private/Share20/Manager.php - line 677:

    OC\Files\Storage\Wrapper\Wrapper->__call()

    /var/www/nextcloud/lib/private/Share20/Manager.php - line 767:

    OC\Share20\Manager->setLinkParent()

    /var/www/nextcloud/apps/files_sharing/lib/Controller/ShareAPIController.php - line 701:

    OC\Share20\Manager->createShare()

    /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 225:

    OCA\Files_Sharing\Controller\ShareAPIController->createShare()

    /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 133:

    OC\AppFramework\Http\Dispatcher->executeController()

    /var/www/nextcloud/lib/private/AppFramework/App.php - line 172:

    OC\AppFramework\Http\Dispatcher->dispatch()

    /var/www/nextcloud/lib/private/Route/Router.php - line 298:

    OC\AppFramework\App::main()

    /var/www/nextcloud/ocs/v1.php - line 63:

    OC\Route\Router->match()

    /var/www/nextcloud/ocs/v2.php - line 23:

    require_once("/var/www/nextcloud/ocs/v1.php")

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => '****',
  'passwordsalt' => '***',
  'secret' => '***',
  'trusted_domains' =>
  array (
    0 => '****',
  ),
  'datadirectory' => '/var/www/nextcloud/data',
  'default_language' => '**',
  'default_locale' => '**',
  'force_language' => '**',
  'force_locale' => '****',
  'dbtype' => 'mysql',
  'version' => '25.0.2.3',
  'overwrite.cli.url' => 'https://192.168.1.81',
  'overwriteprotocol' => 'https',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => '****',
  'dbpassword' => '****',
  'installed' => true,
  'onlyoffice' =>
  array (
    'verify_peer_off' => true,
    'jwt_header' => 'XOCAuth',
  ),
  'skeletondirectory' => '',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => 'localhost',
    'port' => 6379,
  ),
  'enable_previews' => true,
  'enabledPreviewProviders' =>
  array (
    0 => 'OC\\Preview\\PNG',
    1 => 'OC\\Preview\\JPEG',
    2 => 'OC\\Preview\\GIF',
    3 => 'OC\\Preview\\HEIC',
    4 => 'OC\\Preview\\BMP',
    5 => 'OC\\Preview\\XBitmap',
    6 => 'OC\\Preview\\MP3',
    7 => 'OC\\Preview\\TXT',
    8 => 'OC\\Preview\\MarkDown',
    9 => 'OC\\Preview\\Movie',
    10 => 'OC\\Preview\\MKV',
    11 => 'OC\\Preview\\MP4',
    12 => 'OC\\Preview\\AVI',
    13 => 'OC\\Preview\\PDF',
  ),
  'allow_local_remote_servers' => true,
  'default_phone_region' => '**',
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 2,
  'mail_from_address' => '****',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => '****.**',
  'mail_smtphost' => 'smtp.****.**',
  'mail_smtpport' => '587',
  'updater.release.channel' => 'stable',
  'mail_smtpauthtype' => 'NTLM',
  'mail_smtpauth' => 1,
  'mail_smtpname' => '****@****.**',
  'mail_smtppassword' => '****',
  'app_install_overwrite' =>
  array (
    0 => 'impersonate',
  ),
);

The output of your nginx/system log in /var/log/____:

Stack trace:
#0 /var/www/nextcloud/lib/private/RedisFactory.php(137): Redis->pconnect()
#1 /var/www/nextcloud/lib/private/RedisFactory.php(178): OC\RedisFactory->create()
#2 /var/www/nextcloud/lib/private/Memcache/Redis.php(43): OC\RedisFactory->getInstance()
#3 /var/www/nextcloud/lib/private/Memcache/Factory.php(118): OC\Memcache\Redis->__construct()
#4 /var/www/nextcloud/lib/private/Server.php(1120): OC\Memcache\Factory->createLocking()
#5 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(162): OC\Server->OC\{closure}()
#6 /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(122): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}()
#7 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(129): Pimple\Container->offsetGet()
#8 /var/www/nextcloud/lib/private/ServerCont" while reading response header from upstream, client: 192.168.1.238, server: ****.****.**, request: "GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "****.****.**"

Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.

Same as above

Alright, did some more “debugging” and it seems like the problem is related to php8.0 and php8.1. Went back to php7.4 and the problem is gone.

Maybe it is something look into?