I have a PHP script that reads files from Cloud Storage. It works fine in local dev. But when it's run in App Engine standard environment, it outputs this error message:
Fatal error: Uncaught Google\Cloud\Core\Exception\ServiceException in /srv/vendor/google/cloud/Core/src/RequestWrapper.php:362
Stack trace:
#0 /srv/vendor/google/cloud/Core/src/RequestWrapper.php(206): Google\Cloud\Core\RequestWrapper->convertToGoogleException(Object(GuzzleHttp\Exception\RequestException))
#1 /srv/vendor/google/cloud/Storage/src/Connection/Rest.php(224): Google\Cloud\Core\RequestWrapper->send(Object(GuzzleHttp\Psr7\Request), Array)
#2 /srv/vendor/google/cloud/Storage/src/StorageObject.php(643): Google\Cloud\Storage\Connection\Rest->downloadObject(Array)
#3 /srv/vendor/google/cloud/Storage/src/StorageObject.php(574): Google\Cloud\Storage\StorageObject->downloadAsStream(Array)
#4 /srv/modules/profile/controllers/getresource.class.php(69): Google\Cloud\Storage\StorageObject->downloadAsString()
This doesn't happen to most of the files. The file causing this issue is about 250KB. I am wondering is there some kind of size limitation with downloadAsString()?
One of the files causing this issue is https://www.justjeans.com.au/wcsstore/JustJeansAuroraStorefrontAssetStore/css/main.css?timestamp=2019070295000
The downloadAsString() method downloads the file using stream, and then casts it to a string before returning it.
Link to the SDK code
There should not be any issues with file sizes unless you are running out of memory in your PHP process.
Is there a file that causes the issue every time? If so, maybe adding that to the question would be a good idea.
Related
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?
I recently installed git for sharing cakephp 3.0 code but after pushing and pulling the browser seems blank then I edit .gitignore file and remove all commands excluding /tem/* because I didn't worry about security right now and then I shared my code and got this error:
Fatal error: Class 'Psr\Log\AbstractLogger' not found in /var/www/html/project/bmw12/vendor/cakephp/cakephp/src/Log/Engine/BaseLog.php on line 24
Fatal error: Uncaught RuntimeException: Could not load class Cake\Log\Engine\FileLog in /var/www/html/project/bmw12/vendor/cakephp/cakephp/src/Log/LogEngineRegistry.php:57 Stack trace: #0
/var/www/html/project/bmw12/vendor/cakephp/cakephp/src/Core/ObjectRegistry.php(91): Cake\Log\LogEngineRegistry->_throwMissingClassError('Cake\\Log\\Engine...', NULL) #1
/var/www/html/project/bmw12/vendor/cakephp/cakephp/src/Log/Log.php(198): Cake\Core\ObjectRegistry->load('Cake\\Log\\Engine...', Array) #2
/var/www/html/project/bmw12/vendor/cakephp/cakephp/src/Log/Log.php(180): Cake\Log\Log::_loadConfig() #3
/var/www/html/project/bmw12/vendor/cakephp/cakephp/src/Log/Log.php(360): Cake\Log\Log::_init() #4
/var/www/html/project/bmw12/vendor/cakephp/cakephp/src/Error/BaseErrorHandler.php(284): Cake\Log\Log::write(3, 'Fatal Error (1)...') #5
/var/www/html/project/bmw12/vendor/cakephp/cakephp/src/Error/BaseErrorHandler.php(216): Cake\Error\BaseErrorHandler->_logError(3, Array) #6
/var/www/html/project/bmw12/vendor/cakephp/cakephp/src/Error/Bas in /var/www/html/project/bmw12/vendor/cakephp/cakephp/src/Log/LogEngineRegistry.php on line 57
I m posting answer for my question, actually its a permission issue in Linux and therefore it doesn't allow to share all the file while using push command in git but while using it doesn't show any error but it doesn't work properly on other end.
I'm trying to push a zend application onto an amazon EC2 instance.
I have set up my Zend application on the server and have set up the httpd conf.
When I try to access my website through the browser, I get the following message printed:
bootstrap() ->run();
I have followed all the standard procedures and am able to see static HTML files. But when I try to access PHP files, I see a blank page.
I checked the log files but those do not return any errors.
Any idea why I'm facing this issue.
Update:
I updated my php.ini file with the zend library include_path.
Now I'm faced with the following error:
Fatal error: Uncaught exception 'Zend_Application_Bootstrap_Exception' with message 'Resource
matching "Jquery" not found' in /usr/share/php/libzend-framework-php/Zend/Application/Bootstrap
/BootstrapAbstract.php:694 Stack trace: #0 /usr/share/php/libzend-framework-php/Zend/Application
/Bootstrap/BootstrapAbstract.php(626):
Zend_Application_Bootstrap_BootstrapAbstract->_executeResource('Jquery') #1 /usr/share/php/libzend-
framework-php/Zend/Application/Bootstrap/BootstrapAbstract.php(586):
Zend_Application_Bootstrap_BootstrapAbstract->_bootstrap(NULL) #2 /usr/share/php/libzend-framework-
php/Zend/Application.php(355): Zend_Application_Bootstrap_BootstrapAbstract->bootstrap(NULL) #3
/var/www/html/urban-chatter/public/index.php(29): Zend_Application->bootstrap() #4 {main} thrown in
/usr/share/php/libzend-framework-php/Zend/Application/Bootstrap/BootstrapAbstract.php on line 694
Solved:
I copied the zend library from my system onto the server and changed the include_path to the new library in php.ini file and everything started working. I think there was some compatibility issues when I used another version of zend library.
I seem to be getting an error when trying to upload large files into MongoDB..
Fatal error: Uncaught exception 'MongoGridFSException' with message 'could not open file ' in /home/jclark/thundergrid.fusionstrike.com/thundergrid/thundergrid.php:33 Stack trace: #0 /home/jclark/thundergrid.fusionstrike.com/thundergrid/thundergrid.php(33): MongoGridFS->storeUpload('pic', Array) #1 /home/jclark/thundergrid.fusionstrike.com/thundergrid/admin/index.php(7): Admin->upload() #2 {main} Next exception 'MongoGridFSException' with message 'error setting up file: ' in /home/jclark/thundergrid.fusionstrike.com/thundergrid/thundergrid.php:33 Stack trace: #0 /home/jclark/thundergrid.fusionstrike.com/thundergrid/thundergrid.php(0): MongoGridFS->storeUpload() #1 /home/jclark/thundergrid.fusionstrike.com/thundergrid/admin/index.php(7): Admin->upload() #2 {main} thrown in /home/jclark/thundergrid.fusionstrike.com/thundergrid/thundergrid.php on line 33
Is there a reason I'm getting these or...
Many thanks!
If the file is over 2GB/4GB, then this is likely a limitation on how PHP is build on your platform. In most cases, LFS (large file system) is not enabled (and theoretically it's not officially supported by the PHP dev team either). It is also possible that you are using a 32-bit compile of PHP as well, in which case you need a 64-bit build.
I am gelling following error while trying to read file content which is residing in a subfolder rather than a parent folder.
Fatal error: Uncaught exception 'Exception' with message 'Invalid
signature. Expected signature base string:
GET&https%3A%2F%2Fapi-content.dropbox.com%2F1%2Ffiles%2Fdropbox%2FProjects%2FMAC%2520Error.rtf&oauth_consumer_key%3Dbdagb07uu6zq827%26oauth_nonce%3D46d063d5815a0972d63cf72359c0349f%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1324449973%26oauth_token%3D7f2cr9kppqo2hxz%26oauth_version%3D1.0
(Status Code: 403)' in
/Applications/MAMP/htdocs/dbcatalog/BenTheDesigner-Dropbox-88e3876/Dropbox/OAuth/Consumer/Curl.php:133
Stack trace: #0
/Applications/MAMP/htdocs/dbcatalog/BenTheDesigner-Dropbox-88e3876/Dropbox/API.php(109):
Dropbox\OAuth\Consumer\Curl->fetch('GET', 'https://api-con...',
'files/dropbox/P...', Array) #1
/Applications/MAMP/htdocs/dbcatalog/BenTheDesigner-Dropbox-88e3876/check.php(21):
Dropbox\API->getFile('Projects/MAC Er...') #2 {main} thrown in
/Applications/MAMP/htdocs/dbcatalog/BenTheDesigner-Dropbox-88e3876/Dropbox/OAuth/Consumer/Curl.php
on line 133
I am using Ben's Dropbox Library for php
https://github.com/BenTheDesigner/Dropbox
Thanks
If you are looking for a simple PHP-API you can find one here:
https://github.com/hawaiianchimp/Dropbox-PHP-API/
This is the message thats returned when a OAuth request is signed incorrectly. This is likely the fault of the library you're using. At first glance, it looks like it may be encoding the name of your "MAC Error.rtf" file incorrectly. Checkout the PHP SDK dropbox mentions on its website as an alternative and raise this issue with the library's owner.
The code that generates this would help too.