Error: Call to undefined function Aws\boolean_value() using S3

Steps to reproduce

  1. Setup a S3 bucket as primary storage like described here Configuring S3 as Primary Storage :: ownCloud Documentation
  2. Used files_primary_s3
  3. Uploading a file in the storage of any user (created AFTER setup of S3) results in Call to undefined function Aws\boolean_value()

Expected behaviour

File should be uploaded

Actual behaviour

I get Call to undefined function Aws\boolean_value()

Server configuration

Ubuntu 20.04:

Apache

MySQL 8.x:

PHP version: 7.4

ownCloud version: 10.7 from zip source of today (see ownCloud admin page)

Updated from an older ownCloud or fresh install: no, clean setup

Where did you install ownCloud from: zip from distribution site

Signing status (ownCloud 9.0 and above):

Login as admin user into your ownCloud and access 
http://example.com/index.php/settings/integrity/failed 
paste the results into https://gist.github.com/ and puth the link here.

No errors have been found.

The content of config/config.php:

Log in to the web-UI with an administrator account and click on
'admin' -> 'Generate Config Report' -> 'Download ownCloud config report'
This report includes the config.php settings, the list of activated apps
and other details in a well sanitized form.

or 

If you have access to your command line run e.g.:
sudo -u www-data php occ config:list system
from within your ownCloud installation folder

*ATTENTION:* Do not post your config.php file in public as is. Please use one of the above
methods whenever possible. Both, the generated reports from the web-ui and from occ config:list
consistently remove sensitive data. You still may want to review the report before sending.
If done manually then it is critical for your own privacy to dilligently
remove *all* host names, passwords, usernames, salts and other credentials before posting.
You should assume that attackers find such information and will use them against your systems.
<?php
$CONFIG = array (
  'instanceid' => 'xxx',
  'passwordsalt' => 'xxx',
  'secret' => 'D/xxx',
  'trusted_domains' => 
  array (
    0 => 'own.xxx.xxx',
  ),
  'datadirectory' => '/mnt/web/owncloud/data',
  'overwrite.cli.url' => 'https://xxx',
  'dbtype' => 'mysql',
  'version' => '10.7.0.4',
  'dbname' => 'xxx',
  'dbhost' => 'xxx',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'xxx',
  'dbpassword' => 'xxx',
  'logtimezone' => 'UTC',
  'apps_paths' => 
  array (
    0 => 
    array (
      'path' => '/mnt/web/owncloud/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 => 
    array (
      'path' => '/mnt/web/owncloud/apps-external',
      'url' => '/apps-external',
      'writable' => true,
    ),
  ),
  'installed' => true,
  'objectstore' => [
        'class' => 'OCA\Files_Primary_S3\S3Storage',
        'arguments' => [
            'bucket' => 'xxx-owncloud',
            // uncomment to enable server side encryption
            //'serversideencryption' => 'AES256',
            'options' => [
                // version and region are required
                'version' => '2006-03-01',
                'region'  => 'eu-central-1',
                'credentials' => [
                    // replace key and secret with your credentials
                    'key' => 'xxx',
                    'secret' => 'xxx',
                ],
            ],
        ],
    ],
);

List of activated apps:

If you have access to your command line run e.g.:
sudo -u www-data php occ app:list
from within your ownCloud installation folder.
Enabled:
  - activity:
    - Version: 2.6.0
    - Path: /mnt/web/owncloud/apps/activity
  - comments:
    - Version: 0.3.0
    - Path: /mnt/web/owncloud/apps/comments
  - configreport:
    - Version: 0.2.0
    - Path: /mnt/web/owncloud/apps/configreport
  - dav:
    - Version: 0.6.0
    - Path: /mnt/web/owncloud/apps/dav
  - federatedfilesharing:
    - Version: 0.5.0
    - Path: /mnt/web/owncloud/apps/federatedfilesharing
  - federation:
    - Version: 0.1.0
    - Path: /mnt/web/owncloud/apps/federation
  - files:
    - Version: 1.5.2
    - Path: /mnt/web/owncloud/apps/files
  - files_external:
    - Version: 0.7.1
    - Path: /mnt/web/owncloud/apps/files_external
  - files_external_s3:
    - Version: 1.0.0
    - Path: /mnt/web/owncloud/apps-external/files_external_s3
  - files_mediaviewer:
    - Version: 1.0.4
    - Path: /mnt/web/owncloud/apps/files_mediaviewer
  - files_pdfviewer:
    - Version: 0.12.1
    - Path: /mnt/web/owncloud/apps-external/files_pdfviewer
  - files_primary_s3:
    - Version: 1.1.2
    - Path: /mnt/web/owncloud/apps-external/files_primary_s3
  - files_sharing:
    - Version: 0.14.0
    - Path: /mnt/web/owncloud/apps/files_sharing
  - files_texteditor:
    - Version: 2.3.1
    - Path: /mnt/web/owncloud/apps-external/files_texteditor
  - files_trashbin:
    - Version: 0.9.1
    - Path: /mnt/web/owncloud/apps/files_trashbin
  - files_versions:
    - Version: 1.3.0
    - Path: /mnt/web/owncloud/apps/files_versions
  - firstrunwizard:
    - Version: 1.2.0
    - Path: /mnt/web/owncloud/apps/firstrunwizard
  - market:
    - Version: 0.6.0
    - Path: /mnt/web/owncloud/apps/market
  - notifications:
    - Version: 0.5.2
    - Path: /mnt/web/owncloud/apps/notifications
  - provisioning_api:
    - Version: 0.5.0
    - Path: /mnt/web/owncloud/apps/provisioning_api
  - systemtags:
    - Version: 0.3.0
    - Path: /mnt/web/owncloud/apps/systemtags
  - templateeditor:
    - Version: 0.4.0
    - Path: /mnt/web/owncloud/apps/templateeditor
  - updatenotification:
    - Version: 0.2.1
    - Path: /mnt/web/owncloud/apps/updatenotification

Are you using external storage, if yes which one: local/smb/sftp/…
Trying to use S3…

Are you using encryption: yes/no
No

Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/…
No

Client configuration

Browser:
IE/FF/EDGE/FFox/Brave/Safari

Operating system:
Win, Ubuntu, MacOs

Logs

Web server error log

Insert your webserver log here

ownCloud log (data/owncloud.log)

Insert your ownCloud log here
{"reqId":"YL9e-nSvha@PZNORdCijPAAAAAo","level":4,"time":"2021-06-08T12:13:50+00:00","remoteAddr":"8xxx.xxx","user":"admin","app":"webdav","method":"GET","url":"\/remote.php\/dav\/files\/admin\/509_pullus.jpg?c=60bf5d516bb47&x=40&y=40&forceIcon=0&preview=1","message":"Exception: Call to undefined function Aws\\boolean_value(): {\"Exception\":\"Error\",\"Message\":\"Call to undefined function Aws\\\\boolean_value()\",\"Code\":0,\"Trace\":\"#0 \\\/mnt\\\/web\\\/owncloud\\\/apps-external\\\/files_primary_s3\\\/vendor\\\/aws\\\/aws-sdk-php\\\/src\\\/S3\\\/UseArnRegion\\\/ConfigurationProvider.php(168): Aws\\\\S3\\\\UseArnRegion\\\\Configuration->__construct()\\n#1 \\\/mnt\\\/web\\\/owncloud\\\/apps-external\\\/files_primary_s3\\\/vendor\\\/guzzlehttp\\\/promises\\\/src\\\/Promise.php(203): Aws\\\\S3\\\\UseArnRegion\\\\ConfigurationProvider::Aws\\\\S3\\\\UseArnRegion\\\\{closure}(*** sensitive parameters replaced ***)\\n#2 \\\/mnt\\\/web\\\/owncloud\\\/apps-external\\\/files_primary_s3\\\/vendor\\\/guzzlehttp\\\/promises\\\/src\\\/Promise.php(174): GuzzleHttp\\\\Promise\\\\Promise::callHandler()\\n#3 \\\/mnt\\\/web\\\/owncloud\\\/apps-external\\\/files_primary_s3\\\/vendor\\\/guzzlehttp\\\/promises\\\/src\\\/RejectedPromise.php(40): GuzzleHttp\\\\Promise\\\\Promise::GuzzleHttp\\\\Promise\\\\{closure}(*** sensitive parameters replaced ***)\\n#4 \\\/mnt\\\/web\\\/owncloud\\\/apps-external\\\/files_primary_s3\\\/vendor\\\/guzzlehttp\\\/promises\\\/src\\\/TaskQueue.php(47): GuzzleHttp\\\\Promise\\\\RejectedPromise::GuzzleHttp\\\\Promise\\\\{closure}(*** sensitive parameters replaced ***)\\n#5 \\\/mnt\\\/web\\\/owncloud\\\/apps-external\\\/files_primary_s3\\\/vendor\\\/guzzlehttp\\\/promises\\\/src\\\/Promise.php(246): GuzzleHttp\\\\Promise\\\\TaskQueue->run()\\n#6 \\\/mnt\\\/web\\\/owncloud\\\/apps-external\\\/files_primary_s3\\\/vendor\\\/guzzlehttp\\\/promises\\\/src\\\/Promise.php(223): GuzzleHttp\\\\Promise\\\\Promise->invokeWaitFn()\\n#7 \\\/mnt\\\/web\\\/owncloud\\\/apps-external\\\/files_primary_s3\\\/vendor\\\/guzzlehttp\\\/promises\\\/src\\\/Promise.php(267): GuzzleHttp\\\\Promise\\\\Promise->waitIfPending()\\n#8 \\\/mnt\\\/web\\\/owncloud\\\/apps-external\\\/files_primary_s3\\\/vendor\\\/guzzlehttp\\\/promises\\\/src\\\/Promise.php(225): GuzzleHttp\\\\Promise\\\\Promise->invokeWaitList()\\n#9 \\\/mnt\\\/web\\\/owncloud\\\/apps-external\\\/files_primary_s3\\\/vendor\\\/guzzlehttp\\\/promises\\\/src\\\/Promise.php(62): GuzzleHttp\\\\Promise\\\\Promise->waitIfPending()\\n#10 \\\/mnt\\\/web\\\/owncloud\\\/apps-external\\\/files_primary_s3\\\/vendor\\\/aws\\\/aws-sdk-php\\\/src\\\/S3\\\/S3Client.php(408): GuzzleHttp\\\\Promise\\\\Promise->wait()\\n#11 \\\/mnt\\\/web\\\/owncloud\\\/apps-external\\\/files_primary_s3\\\/vendor\\\/aws\\\/aws-sdk-php\\\/src\\\/ClientResolver.php(316): Aws\\\\S3\\\\S3Client::_apply_use_arn_region()\\n#12 \\\/mnt\\\/web\\\/owncloud\\\/apps-external\\\/files_primary_s3\\\/vendor\\\/aws\\\/aws-sdk-php\\\/src\\\/AwsClient.php(195): Aws\\\\ClientResolver->resolve()\\n#13 \\\/mnt\\\/web\\\/owncloud\\\/apps-external\\\/files_primary_s3\\\/vendor\\\/aws\\\/aws-sdk-php\\\/src\\\/S3\\\/S3Client.php(327): Aws\\\\AwsClient->__construct()\\n#14 \\\/mnt\\\/web\\\/owncloud\\\/apps-external\\\/files_primary_s3\\\/vendor\\\/aws\\\/aws-sdk-php\\\/src\\\/AwsClient.php(440): Aws\\\\S3\\\\S3Client->__construct()\\n#15 \\\/mnt\\\/web\\\/owncloud\\\/apps-external\\\/files_primary_s3\\\/lib\\\/s3storage.php(95): Aws\\\\AwsClient::factory()\\n#16 \\\/mnt\\\/web\\\/owncloud\\\/apps-external\\\/files_primary_s3\\\/lib\\\/s3storage.php(179): OCA\\\\Files_Primary_S3\\\\S3Storage->init()\\n#17 \\\/mnt\\\/web\\\/owncloud\\\/lib\\\/private\\\/Files\\\/ObjectStore\\\/ObjectStoreStorage.php(313): OCA\\\\Files_Primary_S3\\\\S3Storage->readObject()\\n#18 \\\/mnt\\\/web\\\/owncloud\\\/lib\\\/private\\\/Files\\\/Storage\\\/LocalTempFileTrait.php(66): OC\\\\Files\\\\ObjectStore\\\\ObjectStoreStorage->fopen()\\n#19 \\\/mnt\\\/web\\\/owncloud\\\/lib\\\/private\\\/Files\\\/Storage\\\/LocalTempFileTrait.php(48): OC\\\\Files\\\\Storage\\\\Common->toTmpFile()\\n#20 \\\/mnt\\\/web\\\/owncloud\\\/lib\\\/private\\\/Files\\\/Storage\\\/Common.php(265): OC\\\\Files\\\\Storage\\\\Common->getCachedFile()\\n#21 \\\/mnt\\\/web\\\/owncloud\\\/lib\\\/private\\\/Files\\\/Storage\\\/Wrapper\\\/Wrapper.php(371): OC\\\\Files\\\\Storage\\\\Common->getLocalFile()\\n#22 \\\/mnt\\\/web\\\/owncloud\\\/lib\\\/private\\\/Files\\\/Storage\\\/Wrapper\\\/Availability.php(383): OC\\\\Files\\\\Storage\\\\Wrapper\\\\Wrapper->getLocalFile()\\n#23 \\\/mnt\\\/web\\\/owncloud\\\/lib\\\/private\\\/Files\\\/Storage\\\/Wrapper\\\/Encryption.php(837): OC\\\\Files\\\\Storage\\\\Wrapper\\\\Availability->getLocalFile()\\n#24 \\\/mnt\\\/web\\\/owncloud\\\/lib\\\/private\\\/Files\\\/Storage\\\/Wrapper\\\/Wrapper.php(371): OC\\\\Files\\\\Storage\\\\Wrapper\\\\Encryption->getLocalFile()\\n#25 \\\/mnt\\\/web\\\/owncloud\\\/lib\\\/private\\\/Files\\\/Storage\\\/Wrapper\\\/Wrapper.php(371): OC\\\\Files\\\\Storage\\\\Wrapper\\\\Wrapper->getLocalFile()\\n#26 \\\/mnt\\\/web\\\/owncloud\\\/lib\\\/private\\\/Preview\\\/Image.php(49): OC\\\\Files\\\\Storage\\\\Wrapper\\\\Wrapper->getLocalFile()\\n#27 \\\/mnt\\\/web\\\/owncloud\\\/lib\\\/private\\\/Preview.php(1129): OC\\\\Preview\\\\Image->getThumbnail()\\n#28 \\\/mnt\\\/web\\\/owncloud\\\/lib\\\/private\\\/Preview.php(768): OC\\\\Preview->generatePreview()\\n#29 \\\/mnt\\\/web\\\/owncloud\\\/lib\\\/private\\\/Files\\\/Node\\\/File.php(170): OC\\\\Preview->getPreview()\\n#30 \\\/mnt\\\/web\\\/owncloud\\\/apps\\\/dav\\\/lib\\\/Files\\\/PreviewPlugin.php(116): OC\\\\Files\\\\Node\\\\File->getThumbnail()\\n#31 \\\/mnt\\\/web\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/event\\\/lib\\\/WildcardEmitterTrait.php(89): OCA\\\\DAV\\\\Files\\\\PreviewPlugin->httpGet()\\n#32 \\\/mnt\\\/web\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(472): Sabre\\\\DAV\\\\Server->emit()\\n#33 \\\/mnt\\\/web\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(253): Sabre\\\\DAV\\\\Server->invokeMethod()\\n#34 \\\/mnt\\\/web\\\/owncloud\\\/apps\\\/dav\\\/lib\\\/Server.php(330): Sabre\\\\DAV\\\\Server->start()\\n#35 \\\/mnt\\\/web\\\/owncloud\\\/apps\\\/dav\\\/appinfo\\\/v2\\\/remote.php(31): OCA\\\\DAV\\\\Server->exec()\\n#36 \\\/mnt\\\/web\\\/owncloud\\\/remote.php(165): require_once('\\\/mnt\\\/web\\\/ownclo...')\\n#37 {main}\",\"File\":\"\\\/mnt\\\/web\\\/owncloud\\\/apps-external\\\/files_primary_s3\\\/vendor\\\/aws\\\/aws-sdk-php\\\/src\\\/S3\\\/UseArnRegion\\\/Configuration.php\",\"Line\":13}"}

Browser log

Insert your browser log here, this could for example include:

Nothing here, server side error

Re-created same config on same machine but used 10.5, as I had another installation with 10.5 working.
It works like a charm. So there is something broken in 10.7. If I have time I’ll check with 10.6.

Check Using S3 Access Point ARNs the AWS SDK for PHP Version 3 - AWS SDK for PHP in the “Configure the S3 client to use the ARN region instead of the client region” section.
You might need to include use_arn_region => true (or false) in the configuration:

  'options' => [
    // version and region are required
    'version' => '2006-03-01',
    'region'  => 'eu-central-1',
    'use_arn_region' => true,
    'credentials' => [
      'key' => ....
      .....
  ]

Newer version of the library might need that option. Please, read information about that option because I don’t know about the consequences of enabling or disabling that option.
There might be configuration options in your S3 server to fix this problem.

1 Like

This is an option to access bucket if you decided to use access points, in that case you specify an ARN instead of the bucket name. The ARN contains the region and that setting says to use that region instead of the one in the region field.
Seems out of scope to me.

Ok, after some trial and error:

  • You do not need to create access points
  • The bucket must be specified as the plain bucket name, not the ARN
  • use_arn_region must be present and set to false
  • version must be set to latest

With these modifications the 10.7 setup works. Below the actual working snippet:

'objectstore' =[
    				'class' ='OCA\Files_Primary_S3\S3Storage',
    				'arguments' =[
    					// replace this
    					'bucket' ='bucket-plain-name',
    					'options' =[
    						'use_arn_region' =false,
    						'version' ='latest',
    						// replace this
    						'region'  ='eu-central-1',
    						'credentials' =[
    							// replace these
    							'key' ='xyz',
    							'secret' ='xyz',
    						],
    					],
    				],
    			],

I think the doc for 10.7 must be updated to reflect the required changes, the published one just fails.

2 Likes

Hey,

if you think there is an issue in the published documentation then i think it could make sense to open an issue at Issues · owncloud/docs · GitHub. Posting the issue there makes sure that some one of ownCloud is noticing it because it is not guaranteed that it was noticed in this help forums.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.