Unknown error in PHP when using Google Cloud Vision Service - php

enter image description herei'm getting this error and i don't know how to debug this.
Fatal error: Uncaught TypeError: Argument 1 passed to Google\ApiCore\Middleware\RetryMiddleware::Google\ApiCore\Middleware{closure}() must be an instance of Exception, instance of Error given, called in /Users/../Desktop/VISION MAIN/vendor/guzzlehttp/promises/src/Promise.php on line 203 and defined in /Users/../Desktop/VISION MAIN/vendor/google/gax/src/ApiCore/Middleware/RetryMiddleware.php:90
Stack trace:
0 /Users/../Desktop/VISION MAIN/vendor/guzzlehttp/promises/src/Promise.php(203): Google\ApiCore\Middleware\RetryMiddleware->Google\ApiCore\Middleware{closure}(Object(Error))
1 /Users/../Desktop/VISION MAIN/vendor/guzzlehttp/promises/src/Promise.php(156): GuzzleHttp\Promise\Promise::callHandler(2, Object(Error), Array)
2 /Users/../Desktop/VISION MAIN/vendor/guzzlehttp/promises/src/TaskQueue.php(47): GuzzleHttp\Promise\Promise::GuzzleHttp\Promise{closure}()
3 /Users/../Desktop/VISION MAIN/vendor/guzzleh in /Users/../Desktop/VISION MAIN/vendor/google/gax/src/ApiCore/Middleware/RetryMiddleware.php on line 90
Request in php file
main.php(call the request php file)
swift code call the main.php

Related

Error When Trying To Fetch Webhooks List via Shopify API

I am building a Shopify App in PHP using Shopify's own PHP library for Shopify API
When I try to fetch current webhooks, I get this error:
Fatal error: Uncaught TypeError: Argument 1 passed to Shopify\Utils::loadCurrentSession() must be of the type array, null given, called in /www/doc/www.example.com/www/script/index.php on line 45 and defined in /www/doc/www.example.com/www/script/vendor/shopify/shopify-api/src/Utils.php:158 Stack trace: #0 /www/doc/www.example.com/www/script/index.php(45): Shopify\Utils::loadCurrentSession(NULL, NULL, NULL) #1 {main} thrown in /www/doc/www.example.com/www/script/vendor/shopify/shopify-api/src/Utils.php on line 158
PHP code:
$this->test_session = Utils::loadCurrentSession(
$requestHeaders,
$requestCookies,
$isOnline
);
Webhookv2::webhooks(
$this->test_session, // Session
[], // Url Ids
[], // Params
);
Utils.php is part of the Shopify API PHP library

I want to start a local server for Codeigniter-4 with "php spark serve" but get these errors

PS C:\xampp\htdocs\dashboard-db> php spark serve
PHP Fatal error: Uncaught TypeError: Argument 1 passed to CodeIgniter\HTTP\URI::setScheme() must be of the type string, null given, called in C:\xampp\htdocs\dashboard-db\vendor\codeigniter4\framework\system\HTTP\IncomingRequest.php on line 443 and defined in C:\xampp\htdocs\dashboard-db\vendor\codeigniter4\framework\system\HTTP\URI.php:749
Stack trace:
#0 C:\xampp\htdocs\dashboard-db\vendor\codeigniter4\framework\system\HTTP\IncomingRequest.php(443): CodeIgniter\HTTP\URI->setScheme(NULL)
#1 C:\xampp\htdocs\dashboard-db\vendor\codeigniter4\framework\system\HTTP\IncomingRequest.php(207): CodeIgniter\HTTP\IncomingRequest->setPath('', Object(Config\App))
#2 C:\xampp\htdocs\dashboard-db\vendor\codeigniter4\framework\system\HTTP\IncomingRequest.php(169): CodeIgniter\HTTP\IncomingRequest->detectURI('REQUEST_URI', ' http://localho...')
#3 C:\xampp\htdocs\dashboard-db\vendor\codeigniter4\framework\system\Config\Services.php(589): CodeIgniter\HTTP\IncomingRequest->__construct(Object(Config\App), Object(CodeIgniter\HTTP\URI), '', Objec in C:\xampp\htdocs\dashboard-db\vendor\codeigniter4\framework\system\HTTP\URI.php on line 749
Fatal error: Uncaught TypeError: Argument 1 passed to CodeIgniter\HTTP\URI::setScheme() must be of the type string, null given, called in C:\xampp\htdocs\dashboard-db\vendor\codeigniter4\framework\system\HTTP\IncomingRequest.php on line 443 and defined in C:\xampp\htdocs\dashboard-db\vendor\codeigniter4\framework\system\HTTP\URI.php:749
Stack trace:
#0 C:\xampp\htdocs\dashboard-db\vendor\codeigniter4\framework\system\HTTP\IncomingRequest.php(443): CodeIgniter\HTTP\URI->setScheme(NULL)
#1 C:\xampp\htdocs\dashboard-db\vendor\codeigniter4\framework\system\HTTP\IncomingRequest.php(207): CodeIgniter\HTTP\IncomingRequest->setPath('', Object(Config\App))
#2 C:\xampp\htdocs\dashboard-db\vendor\codeigniter4\framework\system\HTTP\IncomingRequest.php(169): CodeIgniter\HTTP\IncomingRequest->detectURI('REQUEST_URI', ' http://localho...')
#3 C:\xampp\htdocs\dashboard-db\vendor\codeigniter4\framework\system\Config\Services.php(589): CodeIgniter\HTTP\IncomingRequest->__construct(Object(Config\App), Object(CodeIgniter\HTTP\URI), '', Objec in C:\xampp\htdocs\dashboard-db\vendor\codeigniter4\framework\system\HTTP\URI.php on line 749
Sorry for the late answer. You probably solved it but this observation might help others too.
The problem may be due to the app.base URL in the .env file. Typing it such as 'localhost' or 'localhost:8080' will be incorrect, you should try typing 'http://localhost' instead.

Argument 3 passed to MongoDB\Driver\Server::executeBulkWrite() must be an instance of MongoDB\Driver\WriteConcern or null

I got an error from mongo db, when I connect with application server through php 7.2,**
Fatal error: Uncaught TypeError: Argument 3 passed to MongoDB\Driver\Server::executeBulkWrite() must be an instance of MongoDB\Driver\WriteConcern or null, array given in /var/www/html/project/apps/vendor/mongodb/mongodb/src/Operation/InsertOne.php:134 Stack trace: #0 /var/www/html/project/apps/vendor/mongodb/mongodb/src/Operation/InsertOne.php(134): MongoDB\Driver\Server->executeBulkWrite('project.app_fe...', Object(MongoDB\Driver\BulkWrite), Array) #1 /var/www/html/project/apps/vendor/mongodb/mongodb/src/Collection.php(931): MongoDB\Operation\InsertOne->execute(Object(MongoDB\Driver\Server)) #2 /var/www/html/project/apps/api/appFeedback.php(75): MongoDB\Collection->insertOne(Array) #3 {main} thrown in /var/www/html/project/apps/vendor/mongodb/mongodb/src/Operation/InsertOne.php on line 134

Laravel 5.1 : Error on install new

When I am running laravel new blog or any name, I get the following error:
Crafting application...
PHP Fatal error: Uncaught TypeException: Argument 2 passed to GuzzleHttp\Adapter\StreamAdapter::createResponseObject() must be of the type array, null given, called in C:\Users\Felix\AppData\Roaming\Composer\vendor\guzzlehttp\guzzle\src\Adapter\StreamAdapter.php on line 67 and defined in C:\Users\Felix\AppData\Roaming\Composer\vendor\guzzlehttp\guzzle\src\Adapter\StreamAdapter.php:71
Stack trace:
#0 C:\Users\Felix\AppData\Roaming\Composer\vendor\guzzlehttp\guzzle\src\Adapter\StreamAdapter.php(67): GuzzleHttp\Adapter\StreamAdapter->createResponseObject(Object(GuzzleHttp\Message\Request), NULL, Object(GuzzleHttp\Adapter\Transaction), Object(GuzzleHttp\Stream\Stream))
#1 C:\Users\Felix\AppData\Roaming\Composer\vendor\guzzlehttp\guzzle\src\Adapter\StreamAdapter.php(52): GuzzleHttp\Adapter\StreamAdapter->createResponse(Object(GuzzleHttp\Adapter\Transaction))
#2 C:\Users\Felix\AppData\Roaming\Composer\vendor\guzzlehttp\guzzle\src\Client.php(193): GuzzleHttp\Adapter\StreamAdapter->send(Object(GuzzleHttp\Adapter\Transaction)) #3 C:\U in C:\Users\Felix\AppData\Roaming\Composer\vendor\guzzlehttp\guzzle\src\Adapter\StreamAdapter.php on line 71
Fatal error: Uncaught TypeException: Argument 2 passed to GuzzleHttp\Adapter\StreamAdapter::createResponseObject() must be of the type array, null given, called in C:\Users\Felix\AppData\Roaming\Composer\vendor\guzzlehttp\guzzle\src\Adapter\StreamAdapter.php on line 67 and defined in C:\Users\Felix\AppData\Roaming\Composer\vendor\guzzlehttp\guzzle\src\Adapter\StreamAdapter.php:71
Stack trace:
#0 C:\Users\Felix\AppData\Roaming\Composer\vendor\guzzlehttp\guzzle\src\Adapter\StreamAdapter.php(67): GuzzleHttp\Adapter\StreamAdapter->createResponseObject(Object(GuzzleHttp\Message\Request), NULL, Object(GuzzleHttp\Adapter\Transaction), Object(GuzzleHttp\Stream\Stream))
#1 C:\Users\Felix\AppData\Roaming\Composer\vendor\guzzlehttp\guzzle\src\Adapter\StreamAdapter.php(52): GuzzleHttp\Adapter\StreamAdapter->createResponse(Object(GuzzleHttp\Adapter\Transaction))
#2 C:\Users\Felix\AppData\Roaming\Composer\vendor\guzzlehttp\guzzle\src\Client.php(193): GuzzleHttp\Adapter\StreamAdapter->send(Object(GuzzleHttp\Adapter\Transaction)) #3 C:\U in C:\Users\Felix\AppData\Roaming\Composer\vendor\guzzlehttp\guzzle\src\Adapter\StreamAdapter.php on line 71
I don't understand how this can happen. Here is my PhpInfo file
Thanks
The answer was simple. I was running PHP CLI from PHP7 and not XAMPP/PHP5. Only have to uncomment the extension=php_curl.dll line.

How to solve "Uncaught exception 'google\net\ProtocolBufferEncodeError'"

I'm using Google App Engine in combination with PHP.
After a couple request I get the following error
Fatal error: Uncaught exception 'google\net\ProtocolBufferEncodeError' with message 'Internal bug: Encoded size doesn't match predicted' in /base/data/home/runtimes/php/sdk/google/appengine/runtime/proto/ProtocolMessage.php:68
Stack trace:
#0 /base/data/home/runtimes/php/sdk/google/appengine/runtime/proto/ProtocolMessage.php(50): google\net\ProtocolMessage->serializePartialToString()
#1 /base/data/home/runtimes/php/sdk/google/appengine/runtime/RealApiProxy.php(52): google\net\ProtocolMessage->serializeToString()
#2 /base/data/home/runtimes/php/sdk/google/appengine/runtime/ApiProxy.php(42): google\appengine\runtime\RealApiProxy->makeSyncCall('taskqueue', 'BulkAdd', Object(google\appengine\TaskQueueBulkAddRequest), Object(google\appengine\TaskQueueBulkAddResponse), NULL)
#3 /base/data/home/runtimes/php/sdk/google/appengine/api/taskqueue/PushQueue.php(195): google\appengine\runtime\ApiProxy::makeSyncCall('taskqueue', 'BulkAdd', Object(google\appengine\TaskQueueBulkAddRequest), Object(google\appengine\TaskQueueBulkAddResponse in /base/data/home/runtimes/php/sdk/google/appengine/runtime/proto/ProtocolMessage.php on line 68
Fatal error: Uncaught exception 'google\net\ProtocolBufferEncodeError' with message 'Internal bug: Encoded size doesn't match predicted' in /base/data/home/runtimes/php/sdk/google/appengine/runtime/proto/ProtocolMessage.php:68
Stack trace:
#0 /base/data/home/runtimes/php/sdk/google/appengine/runtime/proto/ProtocolMessage.php(50): google\net\ProtocolMessage->serializePartialToString()
#1 /base/data/home/runtimes/php/sdk/google/appengine/runtime/RealApiProxy.php(52): google\net\ProtocolMessage->serializeToString()
#2 /base/data/home/runtimes/php/sdk/google/appengine/runtime/ApiProxy.php(42): google\appengine\runtime\RealApiProxy->makeSyncCall('taskqueue', 'BulkAdd', Object(google\appengine\TaskQueueBulkAddRequest), Object(google\appengine\TaskQueueBulkAddResponse), NULL)
#3 /base/data/home/runtimes/php/sdk/google/appengine/api/taskqueue/PushQueue.php(195): google\appengine\runtime\ApiProxy::makeSyncCall('taskqueue', 'BulkAdd', Object(google\appengine\TaskQueueBulkAddRequest), Object(google\appengine\TaskQueueBulkAddResponse in /base/data/home/runtimes/php/sdk/google/appengine/runtime/proto/ProtocolMessage.php on line 68
To solve this I shutdown all the instances and the code just loads normally. And again after a couple of request I get the same fatal error.
What can cause this Fatal error ? And how do I solve it.
The error is raised in the following file
https://chromium.googlesource.com/external/googleappengine/python/+/4523f63814037ed833b8bb55273c09a43dd69fb0/php/sdk/google/appengine/runtime/proto/ProtocolMessage.php

Categories