'PHP Google Cloud Storage - "BadRequestException: Malformed multipart body"
I'm using the PHP Google Cloud Storage library (https://github.com/googleapis/google-cloud-php-storage) to upload .msg (outlook message export) files.
However while it works most of the time I'm getting the error below for about 1 in 200 files.
PHP Fatal error: Uncaught Google\Cloud\Core\Exception\BadRequestException: Malformed multipart body. in /home/jamie/import_systems/vendor/google/cloud-core/src/RequestWrapper.php:368
Stack trace:
#0 /home/jamie/import_systems/vendor/google/cloud-core/src/RequestWrapper.php(207): Google\Cloud\Core\RequestWrapper->convertToGoogleException()
#1 /home/jamie/import_systems/vendor/google/cloud-core/src/Upload/MultipartUploader.php(44): Google\Cloud\Core\RequestWrapper->send()
#2 /home/jamie/import_systems/vendor/google/cloud-storage/src/Bucket.php(294): Google\Cloud\Core\Upload\MultipartUploader->upload()
#3 /home/jamie/import_systems/file_uploader.php(47): Google\Cloud\Storage\Bucket->upload()
#4 /home/jamie/import_systems/file_uploader.php(18): UploadAndLinkUpAttachments()
#5 {main}
thrown in /home/jamie/import_systems/vendor/google/cloud-core/src/RequestWrapper.php on line 368
Interestingly I can upload the same files without any issues through the Cloud Storage GUI into the same bucket.
I've checked the library for any encoding options/config but can't see any. I understand its something about the .msg files structure but I would have assumed the library would see that and escape it.
What could the issue be? Or where can I start to debug this?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
