upstox / upstox-php

Official PHP SDK for accessing Upstox API
MIT License
2 stars 2 forks source link

Error: Uncaught Error: Class "Google\Protobuf\Internal\Message" not found #13

Open san-kumar opened 1 week ago

san-kumar commented 1 week ago

Hi,

When I run the websocket_client.php I get this error:

Connection successful!
PHP Fatal error:  Uncaught Error: Class "Google\Protobuf\Internal\Message" not found in /home/work/tmp/upstox-php-master/examples/websocket/market_data/protobuf/Com/Upstox/Marketdatafeeder/Rpc/Proto/FeedResponse.php:14
Stack trace:
#0 /home/work/tmp/upstox-php-master/examples/websocket/market_data/vendor/composer/ClassLoader.php(576): include()
#1 /home/work/tmp/upstox-php-master/examples/websocket/market_data/vendor/composer/ClassLoader.php(427): Composer\Autoload\{closure}()
#2 /home/work/tmp/upstox-php-master/examples/websocket/market_data/websocket_client.php(19): Composer\Autoload\ClassLoader->loadClass()
#3 /home/work/tmp/upstox-php-master/examples/websocket/market_data/websocket_client.php(94): decodeProtobuf()
#4 /home/work/tmp/upstox-php-master/examples/websocket/market_data/websocket_client.php(102): fetchMarketUpdates()
#5 {main}
  thrown in /home/work/tmp/upstox-php-master/examples/websocket/market_data/protobuf/Com/Upstox/Marketdatafeeder/Rpc/Proto/FeedResponse.php on line 14

I did run composer install and it was successful. But looks like some issue with the library.

Any ideas?

san-kumar commented 1 week ago

Ok, I figured it out. composer.json inside market_data directory needs to be updated with following in the require section:

        "google/protobuf": "^3.25"

Let me know if you guys accept pull requests.