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

S3 Primary Storage In Asia Pacific (Sydney) not working; The authorization header is malformed #7524

Closed
DarkAxi0m opened this issue Dec 15, 2017 · 2 comments

Comments

@DarkAxi0m
Copy link

Steps to reproduce

  1. Created a new bucket in Asia Pacific (Sydney) region
  2. Setup key/secret (and tested)
  3. Clean install of nextcloud-12.0.4
    Following https://docs.nextcloud.com/server/12/admin_manual/installation/source_installation.html#ubuntu-installation-label
  4. Before Starting Wizard created "objectstore.config.php"
$CONFIG
 = array (
  'objectstore' =>
  array (
    'class' => 'OC\\Files\\ObjectStore\\S3',
    'arguments' =>
    array (
      'bucket' => 'buckname',
      'autocreate' => true,
      'key' => 'bucknamekey',
      'secret' => 'bucknamesecret',
      'hostname' => 's3-ap-southeast-2.amazonaws.com',
      'use_ssl' => true,
      'use_path_style' => true,
    ),
  ),
);

Expected behaviour

Normal Nextcloud dashboard, with s3 as Primary Storage

Actual behaviour

Browser shows

Internal Server Error

The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the server log.

Logs show an Aws\S3\Exception\S3Exception Exception.

Error executing "PutObject" on "https://s3-ap-southeast-2.amazonaws.com/nextcloudsirmonkeys/urn:oid:136"; AWS HTTP error: Client error response [url] https://s3-ap-southeast-2.amazonaws.com/nextcloudsirmonkeys/urn:oid:136 [status code] 400 [reason phrase] Bad Request AuthorizationHeaderMalformed (client): The authorization header is malformed; the region 'eu-west-1' is wrong; expecting 'ap-southeast-2' -
AuthorizationHeaderMalformed</Code>The authorization header is malformed; the region 'eu-west-1' is wrong; expecting 'ap-southeast-2'</Message>ap-southeast-2</Region>0F7749F409D16EFB</RequestId>jjF2PKbabrBFKkDJMGcCmWQKaVuPClCwjizrnexXiHjeqhgV5OBDEvB18btaeBcWBb1FJBNIjug=</HostId></Error>

Trace:

#0 /var/www/nextcloud/3rdparty/aws/aws-sdk-php/src/WrappedHttpHandler.php(101): Aws\WrappedHttpHandler->parseError(Array, Object(GuzzleHttp\Psr7\Request), Object(Aws\Command), Array)
#1 /var/www/nextcloud/3rdparty/guzzlehttp/promises/src/Promise.php(203): Aws\WrappedHttpHandler->Aws{closure}(Array)
#2 /var/www/nextcloud/3rdparty/guzzlehttp/promises/src/Promise.php(174): GuzzleHttp\Promise\Promise::callHandler(2, Array, Array)
#3 /var/www/nextcloud/3rdparty/guzzlehttp/promises/src/RejectedPromise.php(40): GuzzleHttp\Promise\Promise::GuzzleHttp\Promise{closure}(Array)
#4 /var/www/nextcloud/3rdparty/guzzlehttp/promises/src/TaskQueue.php(47): GuzzleHttp\Promise\RejectedPromise::GuzzleHttp\Promise{closure}()
#5 /var/www/nextcloud/3rdparty/guzzlehttp/promises/src/Promise.php(234): GuzzleHttp\Promise\TaskQueue->run()
#6 /var/www/nextcloud/3rdparty/guzzlehttp/promises/src/Promise.php(267): GuzzleHttp\Promise\Promise->waitIfPending()
#7 /var/www/nextcloud/3rdparty/guzzlehttp/promises/src/Promise.php(225): GuzzleHttp\Promise\Promise->invokeWaitList()
#8 /var/www/nextcloud/3rdparty/guzzlehttp/promises/src/Promise.php(267): GuzzleHttp\Promise\Promise->waitIfPending()
#9 /var/www/nextcloud/3rdparty/guzzlehttp/promises/src/Promise.php(225): GuzzleHttp\Promise\Promise->invokeWaitList()
#10 /var/www/nextcloud/3rdparty/guzzlehttp/promises/src/Promise.php(62): GuzzleHttp\Promise\Promise->waitIfPending()
#11 /var/www/nextcloud/3rdparty/aws/aws-sdk-php/src/AwsClientTrait.php(59): GuzzleHttp\Promise\Promise->wait()
#12 /var/www/nextcloud/3rdparty/aws/aws-sdk-php/src/AwsClientTrait.php(78): Aws\AwsClient->execute(Object(Aws\Command))
#13 /var/www/nextcloud/lib/private/Files/ObjectStore/S3ObjectTrait.php(90): Aws\AwsClient->__call('putObject', Array)
#14 /var/www/nextcloud/lib/private/Files/ObjectStore/S3ObjectTrait.php(79): OC\Files\ObjectStore\S3->singlePartUpload('urn:oid:136', Resource id #176)
#15 /var/www/nextcloud/lib/private/Files/ObjectStore/ObjectStoreStorage.php(406): OC\Files\ObjectStore\S3->writeObject('urn:oid:136', Resource id #176)
#16 /var/www/nextcloud/lib/private/Files/ObjectStore/ObjectStoreStorage.php(306): OC\Files\ObjectStore\ObjectStoreStorage->writeBack('/tmp/oc_tmp_MtB...', 'appdata_ockpeoq...')
#17 [internal function]: OC\Files\ObjectStore\ObjectStoreStorage->OC\Files\ObjectStore{closure}()
#18 /var/www/nextcloud/3rdparty/icewind/streams/src/CallbackWrapper.php(109): call_user_func(Object(Closure))
#19 [internal function]: Icewind\Streams\CallbackWrapper->stream_close()
#20 /var/www/nextcloud/lib/private/Files/Storage/Common.php(201): fclose(Resource id #175)
#21 /var/www/nextcloud/lib/private/Files/ObjectStore/ObjectStoreStorage.php(357): OC\Files\Storage\Common->file_put_contents('appdata_ockpeoq...', ' ')
#22 /var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php(349): OC\Files\ObjectStore\ObjectStoreStorage->touch('appdata_ockpeoq...', 1513308680)
#23 /var/www/nextcloud/lib/private/Files/Storage/Wrapper/Availability.php(373): OC\Files\Storage\Wrapper\Wrapper->touch('appdata_ockpeoq...', NULL)
#24 /var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php(349): OC\Files\Storage\Wrapper\Availability->touch('appdata_ockpeoq...', NULL)
#25 /var/www/nextcloud/lib/private/Files/View.php(1156): OC\Files\Storage\Wrapper\Wrapper->touch('appdata_ockpeoq...')
#26 /var/www/nextcloud/lib/private/Files/View.php(579): OC\Files\View->basicOperation('touch', '/appdata_ockpeo...', Array, NULL)
#27 /var/www/nextcloud/lib/private/Files/Node/Folder.php(181): OC\Files\View->touch('/appdata_ockpeo...')
#28 /var/www/nextcloud/lib/private/Files/SimpleFS/SimpleFolder.php(83): OC\Files\Node\Folder->newFile('merged-template...')
#29 /var/www/nextcloud/lib/private/Template/JSCombiner.php(163): OC\Files\SimpleFS\SimpleFolder->newFile('merged-template...')
#30 /var/www/nextcloud/lib/private/Template/JSCombiner.php(89): OC\Template\JSCombiner->cache('/var/www/nextcl...', 'merged-template...', Object(OC\Files\SimpleFS\SimpleFolder))
#31 /var/www/nextcloud/lib/private/Template/JSResourceLocator.php(112): OC\Template\JSCombiner->process('/var/www/nextcl...', 'core/js/merged-...', 'core')
#32 /var/www/nextcloud/lib/private/Template/JSResourceLocator.php(68): OC\Template\JSResourceLocator->cacheAndAppendCombineJsonIfExist('/var/www/nextcl...', 'core/js/merged-...')
#33 /var/www/nextcloud/lib/private/Template/ResourceLocator.php(76): OC\Template\JSResourceLocator->doFind('js/merged-templ...')
#34 /var/www/nextcloud/lib/private/TemplateLayout.php(249): OC\Template\ResourceLocator->find(Array)
#35 /var/www/nextcloud/lib/private/TemplateLayout.php(132): OC\TemplateLayout::findJavascriptFiles(Array)
#36 /var/www/nextcloud/lib/private/legacy/template.php(205): OC\TemplateLayout->__construct('error', '')
#37 /var/www/nextcloud/lib/private/Template/Base.php(132): OC_Template->fetchPage()
#38 /var/www/nextcloud/lib/private/legacy/template.php(342): OC\Template\Base->printPage()
#39 /var/www/nextcloud/index.php(67): OC_Template::printExceptionErrorPage(Object(OCP\Files\NotFoundException))
#40 {main}

Server configuration

Operating system: Ubuntu 16.04.3 LTS

Web server: Apache/2.4.18 (Ubuntu)

Database: 10.0.31-MariaDB-0ubuntu0.16.04.2

PHP version: PHP 7.0.22-0ubuntu0.16.04.1

Nextcloud version: 12.0.4

Updated from an older Nextcloud/ownCloud or fresh install: fresh install

Where did you install Nextcloud from: https://download.nextcloud.com/server/releases/nextcloud-12.0.4.zip

Signing status: No errors have been found.

List of activated apps:

Enabled:

  • activity: 2.5.2
  • comments: 1.2.0
  • dav: 1.3.0
  • federatedfilesharing: 1.2.0
  • federation: 1.2.0
  • files: 1.7.2
  • files_pdfviewer: 1.1.1
  • files_sharing: 1.4.0
  • files_texteditor: 2.4.1
  • files_trashbin: 1.2.0
  • files_versions: 1.5.0
  • files_videoplayer: 1.1.0
  • firstrunwizard: 2.1
  • gallery: 17.0.0
  • logreader: 2.0.0
  • lookup_server_connector: 1.0.0
  • nextcloud_announcements: 1.1
  • notifications: 2.0.0
  • oauth2: 1.0.5
  • password_policy: 1.2.2
  • provisioning_api: 1.2.0
  • serverinfo: 1.2.0
  • sharebymail: 1.2.0
  • survey_client: 1.0.0
  • systemtags: 1.2.0
  • theming: 1.3.0
  • twofactor_backupcodes: 1.1.1
  • updatenotification: 1.2.0
  • workflowengine: 1.2.0
    Disabled:
  • admin_audit
  • encryption
  • files_external
  • user_external
  • user_ldap

Nextcloud configuration:

{
    "system": {
        "instanceid": "ockpeoqda2dy",
        "objectstore": {
            "class": "OC\\Files\\ObjectStore\\S3",
            "arguments": {
                "bucket": ""***REMOVED SENSITIVE VALUE***",
                "autocreate": true,
                "key": ""***REMOVED SENSITIVE VALUE***",
                "secret": ""***REMOVED SENSITIVE VALUE***",
                "hostname": "s3-ap-southeast-2.amazonaws.com",
                "use_ssl": true,
                "use_path_style": true
            }
        },
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "c.sirmonkeys.com"
        ],
        "datadirectory": "\/var\/www\/nextcloud\/data",
        "overwrite.cli.url": "https:\/\/c.sirmonkeys.com",
        "dbtype": "mysql",
        "version": "12.0.4.3",
        "dbname": "nextcloud",
        "dbhost": "localhost",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true
    }
}

Are you using external storage, if yes which one: S3

Are you using encryption: no

Are you using an external user-backend, if yes which one: no

@DarkAxi0m
Copy link
Author

DarkAxi0m commented Dec 15, 2017

Also, If I only change in the objectstore.config.php file, the bucket to one in EU (Ireland) and the host name to s3-eu-west-1.amazonaws.com then reload, the site works, but very very slowly because the server and s3 region being on the other sides of the world.

@DarkAxi0m
Copy link
Author

got it working by adding 'region' => 'ap-southeast-2' to objectstore.config.php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant