Server: External Storage: Error uploading to Google Cloud Storage

Created on 7 Feb 2019  路  7Comments  路  Source: nextcloud/server

Steps to reproduce

  1. Configure external storage for Google Cloud Storage as you would for Amazon s3
  2. Try to upload to GCS.

Expected behaviour

The file should upload

Actual behaviour

Directories can be created fine, and show up on the bucket, however files will not upload to it and result in an error in the browser.

An exception occurred while initiating a multipart upload: Error executing "CreateMultipartUpload" on "https://mystorage.storage.googleapis.com/polly.jpeg?uploads"; AWS HTTP error: Client error: `POST https://mystorage.storage.googleapis.com/polly.jpeg?uploads` resulted in a `400 Bad Request` response: <?xml version='1.0' encoding='UTF-8'?><Error><Code>InvalidArgument</Code><Message>Invalid argument.</Message><Details>PO (truncated...) InvalidArgument (client): Invalid argument. - <?xml version='1.0' encoding='UTF-8'?><Error><Code>InvalidArgument</Code><Message>Invalid argument.</Message><Details>POST object expects Content-Type multipart/form-data</Details></Error>

Server configuration

Operating system: Ubuntu 18.04.1 LTS

Web server: nginx

Database: MariaDB

PHP version: 7.2

Nextcloud version: 15.0.3

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

Where did you install Nextcloud from:
Download from nextcloud website

Signing status:


Signing status

No errors have been found.

List of activated apps:


Activated apps
Accessibility 1.1.0,
Activity 2.8.2,
Announcement center 3.4.1,
AppOrder 0.6.0,
Calendar 1.6.4,
Collaborative tags 1.5.0,
Comments 1.5.0,
Contacts 3.0.3,
Deck 0.5.2,
Deleted files 1.5.0,
DropIt 0.1.3,
External storage support 1.6.0,
External user support 0.5.0,
Federation 1.5.0,
File sharing 1.7.0,
Files From Mail 0.2.0,
Files Right Click 0.11.0,
Gallery 18.2.0,
Log Reader 2.0.0,
Mail 0.11.0,
Monitoring 1.5.0,
Music 0.9.3,
News 13.0.3,
Nextcloud announcements 1.4.0,
Notifications 2.3.0,
Notifications for calendar event updates 0.3.2,
Password policy 1.5.0,
PDF viewer 1.4.0,
Quota warning 1.4.0,
Radio 0.6.4,
Share by mail 1.5.0,
Support 1.0.0,
Text editor 2.7.0,
Theming 1.6.0,
Update notification 1.5.0,
Usage survey 1.3.0,
Versions 1.8.0,
Video player 1.4.0

Are you using external storage, if yes which one: Amazon s3

Are you using encryption: yes on s3 bucket

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

Client configuration

Browser: Firefox

Operating system: Ubuntu 18.04 LTS

Logs

An exception occurred while initiating a multipart upload: Error executing "CreateMultipartUpload" on "https://mystorage.storage.googleapis.com/polly.jpeg?uploads"; AWS HTTP error: Client error: `POST https://mystorage.storage.googleapis.com/polly.jpeg?uploads` resulted in a `400 Bad Request` response: <?xml version='1.0' encoding='UTF-8'?><Error><Code>InvalidArgument</Code><Message>Invalid argument.</Message><Details>PO (truncated...) InvalidArgument (client): Invalid argument. - <?xml version='1.0' encoding='UTF-8'?><Error><Code>InvalidArgument</Code><Message>Invalid argument.</Message><Details>POST object expects Content-Type multipart/form-data</Details></Error>

0. Needs triage bug

All 7 comments

Same problem here with primary storage.

@icewind1991 @MorrisJobke @rullzer Could somebody take a look, please?

Hi,
We are experiencing exactly the same problem here both with the latest 15.0.x and 16.0.x version of NextCloud.
Any idea or workaround on it?

It seems to be related to the fact that GCP does not handle Multipart uploads

Is there a workaround to this problem?

Edit: this is a "workaround" for the multipart uploader _always_ being used, but it does NOT implement support for large files.

In lib/private/Files/ObjectStore/S3ObjectTrait.php

function writeObject($urn, $stream) {
                // Prevent multipart upload from always being used, 
                // to "fix" uploading files to Google Cloud Storage.
                $this->getConnection()->upload($this->bucket, $urn, $stream, 'private', [
                        'mup_threshold' => S3_UPLOAD_PART_SIZE,
                        'part_size' => S3_UPLOAD_PART_SIZE
                ]);
                return;
                // rest of code goes here

i believe this patch could help https://github.com/nextcloud/server/issues/288#issuecomment-533892009

I am not a PHP programmer, but something like this: https://github.com/nextcloud/server/pull/23781 should solve the issue.

Was this page helpful?
0 / 5 - 0 ratings