Kreya icon indicating copy to clipboard operation
Kreya copied to clipboard

Failed in reflection

Open tcgtam opened this issue 2 years ago • 8 comments

Describe the bug A clear and concise description of what the bug is.

To Reproduce Reflection failed on bytearray I/O object

Expected behavior A clear and concise description of what you expected to happen.

Screenshots { "kreyaVersion": "1.10.1", "releaseChannel": "stable", "osDescription": "Microsoft Windows 10.0.19045", "osVersion": "Microsoft Windows NT 10.0.19045.0", "osArch": "X64", "processArch": "X64", "runtimeIdentifier": "win10-x64", "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.67" }

Google.Protobuf.Reflection.DescriptorValidationException: ird.ntp.fe.epayment.v1.PaymentService.createPaymentURL: ".ird.ntp.fe.epayment.v1.CreatePaymentURLReq" is not defined. at Google.Protobuf.Reflection.DescriptorPool.LookupSymbol(String name, IDescriptor relativeTo) at Google.Protobuf.Reflection.MethodDescriptor.CrossLink() at Google.Protobuf.Reflection.ServiceDescriptor.CrossLink() at Google.Protobuf.Reflection.FileDescriptor.CrossLink() at Google.Protobuf.Reflection.FileDescriptor.BuildFromByteStrings(IEnumerable1 descriptorData, ExtensionRegistry registry) at Google.Protobuf.Reflection.FileDescriptor.BuildFromByteStrings(IEnumerable1 descriptorData) at Kreya.Grpc.Core.Importer.ImporterProtoRegistry.AddDescriptors(IEnumerable1 byteStrings) in C:\dev\gitlab-runner\builds\ifF5m2AW\0\riokch\kreya\kreya\src\grpc\Kreya.Grpc.Core\Importer\ImporterProtoRegistry.cs:line 50 at Kreya.Grpc.Core.Importer.ImporterProtoRegistry.SetDescriptors(IEnumerable1 byteStrings) in C:\dev\gitlab-runner\builds\ifF5m2AW\0\riokch\kreya\kreya\src\grpc\Kreya.Grpc.Core\Importer\ImporterProtoRegistry.cs:line 21 at Kreya.Grpc.Core.Importer.ProtoRegistryAccessor.SetDescriptors(Guid importStreamId, IEnumerable1 byteStrings) in C:\dev\gitlab-runner\builds\ifF5m2AW\0\riokch\kreya\kreya\src\grpc\Kreya.Grpc.Core\Importer\ProtoRegistryAccessor.cs:line 29 at Kreya.Grpc.Core.Importer.BaseGrpcImporter1.Import(IImportStream1 importStream, Boolean allowCache) in C:\dev\gitlab-runner\builds\ifF5m2AW\0\riokch\kreya\kreya\src\grpc\Kreya.Grpc.Core\Importer\BaseGrpcImporter.cs:line 49 at Kreya.Core.Importer.ImporterService.RunSingleImporter(ImportStream importStream, Boolean allowCache, IReadOnlyDictionary2 operationsByInvoker) in C:\dev\gitlab-runner\builds\ifF5m2AW\0\riokch\kreya\kreya\src\Kreya.Core\Importer\ImporterService.cs:line 171 at Kreya.Core.Importer.ImporterService.RunImporter(Guid id, Boolean allowCache) in C:\dev\gitlab-runner\builds\ifF5m2AW\0\riokch\kreya\kreya\src\Kreya.Core\Importer\ImporterService.cs:line 106 at SpiderEye.Bridge.ApiMethod.InvokeAsync(Object instance, Object parameter) at SpiderEye.Bridge.WebviewBridge.InvokeWithDependencyInjection(IDependencyInjectionApiMethod apiMethod, Object parameters) at SpiderEye.Bridge.WebviewBridge.InvokeWithDependencyInjection(IDependencyInjectionApiMethod apiMethod, Object parameters) at SpiderEye.Bridge.WebviewBridge.ResolveCall(String id, String parameters) Environment (if possible, copy the information from the error dialog or the About menu):

  • OS: [e.g. Windows 10]
  • Kreya Version [e.g. 1.0.0-beta.3]

Additional context Add any other context about the problem here.

tcgtam avatar Jul 07 '23 11:07 tcgtam

Thanks for your report. Can you tell us the content of the proto file? It looks like that the PaymentService is missing the CreatePaymentURLReq.

ni507 avatar Jul 07 '23 12:07 ni507

Attached is our proto files. Our gRPC server runs on Java platform and we use Java util to generate gRPC data objects and interface . test.zip

tcgtam avatar Jul 14 '23 02:07 tcgtam

The proto files look good. We were able to set everything up locally and the import into Kreya works. Perhaps your Java services are not yet configured correctly with the proto includes, etc.

ni507 avatar Jul 14 '23 08:07 ni507

The proto files look good. We were able to set everything up locally and the import into Kreya works. Perhaps your Java services are not yet configured correctly with the proto includes, etc.

But, for the same Java service endpoint, we can use Postman to perform reflection and call the corresponding function?

tcgtam avatar Jul 14 '23 08:07 tcgtam

Sorry for the late reply, I tried to reproduce it with a small sample application. With a small basic setup it works for me with your protos.

For the server reflection part I enabled it with ProtoReflectionService.newInstance() . Whole configuration looks like this:

Grpc.newServerBuilderForPort(port, InsecureServerCredentials.create())
                .addService(new PaymentServiceImpl())
                .addService(ProtoReflectionService.newInstance())
                .build()
                .start();

Since it works for me with the protos you provided, it must be a difference in the Java service setup. Can you provide me with more information about your setup?

ni507 avatar Jul 18 '23 10:07 ni507

I'm going to close this issue as no further information was provided

CommonGuy avatar Aug 21 '23 12:08 CommonGuy

Hello,

I had what seems to be the same issue yesterday, and managed to setup a minimal reproduction example here: https://github.com/armisael/test-nest-grpc-reflection

Basically, if two proto files with different package share some messages, Kreya is not able to find them. The example uses Nest.js as server, but reflection is implemented through @grpc/reflection so it should be pretty official.

It could be a bug in the reflection library itself, given that also grpcurl fails to find the shared types (postman works, though, as OP said) but OP was using Java, and this is JS; it could be something due to a gray area in the implementation of server reflection.

armisael avatar May 22 '25 07:05 armisael

Thank you for the reproduction example! We will investigate this

CommonGuy avatar May 22 '25 08:05 CommonGuy

This should be fixed in 1.18.0-beta.4. If you want to try the beta version, check https://kreya.app/docs/faq/#how-can-i-use-kreya-beta-versions.

The reason for the bug was that some gRPC server reflection implementations (such as JavaScript and maybe Java) do not send the dependency information for each protobuf file. The dependency list must be constructed manually

CommonGuy avatar Jul 08 '25 07:07 CommonGuy

I tested the beta version, and can confirm it works with our services, thank you for having a look into this!

armisael avatar Jul 09 '25 07:07 armisael

Great, thank you!

CommonGuy avatar Jul 09 '25 07:07 CommonGuy

Should be fixed with Kreya 1.18, which has just been released

CommonGuy avatar Sep 26 '25 08:09 CommonGuy