-
Notifications
You must be signed in to change notification settings - Fork 444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fatal Error in RequestHandler class with emulator without GRPC extension #7187
Comments
Hello! Thank you for commenting on this. Does it work when you install the In the meantime, if the emulator requires gRPC, we should wrap the |
Yes with gRPC extension it is worked properly. |
Can you elaborate more on this? This is news to me, and it's something we should file as a bug in the grpc repo to get fixed. |
No, because the emulators have never worked with REST, only with gRPC. To confirm this, I checked out We could open this as a feature request against |
@bshaffer afaik the grpc extension was always optional. We were using the pubsub emulator on local machines without grpc and without any credentials file with PubSub v1, but after upgrading to PubSub v2 we can't because we get error:
|
I have tried some half-empty configuration to avoid the first exceptions, but I got the same error, as it is described in this ticket:
It would be great if we could use version 2 in the same way with pubsub emulator without the mandatory grpc extension. |
I ended up creating a stub file and requiring that to get this working - grpc.php.stub: <?php
/**
* PubSubClient assumes that if the PUBSUB_EMULATOR_HOST env var is set that the grpc extension is installed :(
*/
declare(strict_types=1);
namespace Grpc;
if (! class_exists('Grpc\ChannelCredentials')) {
class ChannelCredentials {
public static function createInsecure(): null
{
return null;
}
}
} Then ensure the require_once 'grpc.php.stub';
return new PubSubClient([
'projectId' => 'emulator-project',
'credentialsConfig' => [
'keyFile' => [
"client_id" => "fake-fake-fake.apps.googleusercontent.com",
"client_secret" => "fake-fake-fake",
"refresh_token" => "fake-fake-fake",
"type" => "authorized_user"
],
],
]); (Note that the docblock on the constructor is wrong - the It'd be great to get grpc working without segfaults on swoole / openswoole. No idea where to start on that one though. |
@pulzarraider I'm stuck with the same issue from your comment #7187 (comment). If I understood the discussion it boils down to the missing grpc extension even if it wasn't necessary in pubsub. I presume that once/if your PR googleapis/gax-php#582 gets merged, this should work as in the v1 without any credentials? |
@ollosh even with my MR googleapis/gax-php#582 you will still need credentials. I managed to get it working using these fake credentials for emulator:
|
@pulzarraider thank you! I've managed to get it working with that and with the changes from #7588. If I understand it correctly, those changes from that PR will become obsolete if googleapis/gax-php#582 gets merged? |
@ollosh yes. Code from googleapis/gax-php#582 allows Pub/Sub client to work with emulator without requiring significant modifications to the client to get the http urls mentioned in #7588. |
Amazing, thx for all the info! 🤞 that it gets merged soon! |
Hi
Any Client API (for example PubSub) can not work with emulator without grpc extension.
When we put in clientConfig 'emulatorHost' & 'hasEmulator' keys (PubSub client set it when exist PUBSUB_EMULATOR_HOST env)
then it config passing to RequestHandler constructor and using here
google-cloud-php/Core/src/RequestHandler.php
Line 71 in 8574838
And there call
$this->emulatorGapicConfig
function which part of EmulatorTraithttps://github.com/googleapis/google-cloud-php/blob/main/Core/src/EmulatorTrait.php#L44
And without any conditions code try build array config with call
\Grpc\ChannelCredentials::createInsecure()
which part of GRPC extension.In result:
Another (maybe related) issue when try avoid Fatal error with stub class & method for ChannelCredentials and put in config
['transport' => 'resr']
then I got different error:
Because client by some reason choose HTTPS schema instead of HTTP and emulator don't work with SSL...
So this is bug?
Environment details
Steps to reproduce
Code example
The text was updated successfully, but these errors were encountered: