Skip to content

Unexpected throwable during GRPC input request processing - Error Invoking GRPC #1569

Open
@GomesNayagam

Description

@GomesNayagam

Hi,

As per the the link i am testing my proto and trying to call it from postman, the basic petstore works but mine is not working.

  1. https://microcks.io/documentation/tutorials/first-grpc-mock/

  2. attached is my postman collection.

{ "info": { "_postman_id": "e19d5ddc-1be3-441a-ab43-7aecd9237712", "name": "org.pnp.policy.v1.PolicyService", "description": "version=v1", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", "_exporter_id": "37240777" }, "item": [ { "name": "GetPolicyHeader", "request": { "method": "POST", "header": [], "body": { "mode": "raw", "raw": "{}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "http:///GetPolicyHeader", "protocol": "http", "path": [ "GetPolicyHeader" ] } }, "response": [ { "name": "AllPolicyHeader", "originalRequest": { "method": "POST", "header": [ { "key": "Content-Type", "value": "application/json", "type": "text" } ], "body": { "mode": "raw", "raw": "{}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "http:///GetPolicyHeader", "protocol": "http", "path": [ "GetPolicyHeader" ] } }, "_postman_previewlanguage": null, "header": [ { "key": "Content-Type", "value": "application/json", "description": "", "type": "text" } ], "cookie": [], "body": "{\r\n \"Status\": {\r\n \"Errors\": [],\r\n \"Warnings\": [],\r\n \"HasErrors\": false,\r\n \"HasWarnings\": false,\r\n \"CorrelationId\": \"\"\r\n },\r\n \"LegacyPolicyKey\": {\r\n \"Group\": \"\",\r\n \"UnitNumber\": 4082501,\r\n \"Year\": 2025,\r\n \"Suffix\": \"\"\r\n },\r\n \"PolicyNumber\": 5056094,\r\n \"InceptionDate\": {\r\n \"seconds\": \"1735689600\",\r\n \"nanos\": 0\r\n },\r\n \"ExpirationDate\": {\r\n \"seconds\": \"1767225600\",\r\n \"nanos\": 0\r\n },\r\n \"PolicyStatus\": \"Active\",\r\n \"RenewalStatus\": \"ContinuousCoverage\",\r\n \"AccountNumber\": \"1000638628\",\r\n \"ServicingUnderwriter\": {\r\n \"FirstName\": \"Ronakee\",\r\n \"MiddleName\": \"M\",\r\n \"LastName\": \"Austin\"\r\n },\r\n \"ServicingOffice\": \"Small Commercial Operations\",\r\n \"Brokered\": true,\r\n \"BillPlanCode\": \"STIPULATEDQUARTERLY\",\r\n \"BillPlanType\": \"Stipulated Quarterly\",\r\n \"LegalEntityCode\": \"5\",\r\n \"LegalEntityType\": \"CORPORATION\",\r\n \"StateFundYears\": 1,\r\n \"YearsInBusiness\": 0,\r\n \"EstimatedAnnualPremium\": 2926,\r\n \"KindOfBusiness\": \"NewBusiness\",\r\n \"PolicyAttribute\": {\r\n \"ExtendedAttributes\": [],\r\n \"RiskTypeCode\": \"CAPOLICY\",\r\n \"RiskType\": \"California Policy\"\r\n }\r\n}" } ] } ] }

  1. attached is my proto file

`syntax = "proto3";

import "google/protobuf/timestamp.proto";

package org.pnp.policy.v1;

service PolicyService {
rpc GetPolicyHeader (GetPolicyHeaderRequest) returns (GetPolicyHeaderResponse);
rpc GetContacts (GetContactsRequest) returns (GetContactsResponse);
}

message GetPolicyHeaderRequest {
Client Client = 1;
LegacyPolicyKey LegacyPolicyKey = 2;
}

message GetPolicyHeaderResponse {
enum KindOfBusinessEnum {
NewBusiness = 0;
Renewal = 1;
}
ResponseStatus Status = 1;
LegacyPolicyKey LegacyPolicyKey = 2;
int32 PolicyNumber = 3;
google.protobuf.Timestamp InceptionDate = 4;
google.protobuf.Timestamp ExpirationDate = 5;
string PolicyStatus = 6;
string RenewalStatus = 7;
int64 AccountNumber = 8;
Name ServicingUnderwriter = 9; // Name is set when there is an actual UW assigned. Not applicable when a person is not set as servicing underwriter.
string ServicingOffice = 10; // The new servicing office. Different from legacy regional service location.
bool Brokered = 11;
string BillPlanCode = 12;
string BillPlanType = 13;
string LegalEntityCode = 14;
string LegalEntityType = 15;
int32 StateFundYears = 16;
int32 YearsInBusiness = 17;
double EstimatedAnnualPremium = 18;
KindOfBusinessEnum KindOfBusiness = 19;
PolicyAttribute PolicyAttribute = 20;
}

// comment

message ResponseStatus {
bool HasErrors = 1; // comment
bool HasWarnings =2;
repeated string Errors = 3;
repeated string Warnings = 4;
string CorrelationId = 5;
}

message Name {
string FirstName = 1;
string MiddleName = 2;
string LastName = 3;
}

message LegacyPolicyKey {
string Group = 1;
int32 UnitNumber = 2;
int32 Year = 3;
string Suffix = 4;
}

message PolicyAttribute {
string RiskTypeCode = 1;
string RiskType = 2;
repeated ExtendedPolicyAttribute ExtendedAttributes = 3;
}

message ExtendedPolicyAttribute {
string ExtendedAttributeCode = 1;
string ExtendedAttributeType = 2;
}

message GetContactsRequest {
Client Client = 1;
LegacyPolicyKey LegacyPolicyKey = 2;
}

message GetContactsResponse {
ResponseStatus Status = 1;
repeated Contact Contacts = 2;
}

message Contact {
Name Name = 1;
string Title = 2;
Address Address = 3;
PhoneNumber PhoneNumber = 4;
PhoneNumber CellNumber = 5;
PhoneNumber FaxNumber = 6;
string EmailAddress = 7;
string ContactType = 8;
}

message Address {
string AddressLine1 = 1;
string AddressLine2 = 2;
string City = 3;
string State = 4;
string ZipCode = 5;
string ZipExtension = 6;
}

message PhoneNumber {
string Number = 1;
string Extension = 2;
}

message Client {
string CorrelationId = 1;
enum Clients {
Unknown = 0;
QMS = 1;
BillingCenter = 2;
PAS = 3;
Payroll = 4;
Portal = 5;
SFO = 6;
QuoteAndBind = 7;
LegacyConversion = 8;
BindNow = 9;
PaymentPortal = 10 ;
PricingEngine = 11;
}
Clients ClientName = 2;
}`

  1. error log

`23:47:26.878 INFO 1 --- [executor-6] i.g.m.web.GrpcServerCallHandler : Servicing mock response for service [org.pnp.policy.v1.PolicyService, v1] and method GetPolicyHeader
23:47:26.880 ERROR 1 --- [executor-6] i.g.m.web.GrpcServerCallHandler : Unexpected throwable during GRPC input request processing

com.google.protobuf.InvalidProtocolBufferException: Failed to parse timestamp: {"seconds":"1735689600","nanos":0}
at com.google.protobuf.util.JsonFormat$ParserImpl.mergeTimestamp(JsonFormat.java:1541)
at com.google.protobuf.util.JsonFormat$ParserImpl.access$2200(JsonFormat.java:1276)
at com.google.protobuf.util.JsonFormat$ParserImpl$3.merge(JsonFormat.java:1371)
at com.google.protobuf.util.JsonFormat$ParserImpl.merge(JsonFormat.java:1432)
at com.google.protobuf.util.JsonFormat$ParserImpl.parseFieldValue(JsonFormat.java:1995)
at com.google.protobuf.util.JsonFormat$ParserImpl.mergeField(JsonFormat.java:1646)
at com.google.protobuf.util.JsonFormat$ParserImpl.mergeMessage(JsonFormat.java:1477)
at com.google.protobuf.util.JsonFormat$ParserImpl.merge(JsonFormat.java:1435)
at com.google.protobuf.util.JsonFormat$ParserImpl.merge(JsonFormat.java:1317)
at com.google.protobuf.util.JsonFormat$Parser.merge(JsonFormat.java:449)
at io.github.microcks.web.GrpcServerCallHandler$MockedUnaryMethod.manageResponseTransmission(GrpcServerCallHandler.java:316)
at io.github.microcks.web.GrpcServerCallHandler$MockedUnaryMethod.invoke(GrpcServerCallHandler.java:207)
at io.github.microcks.web.GrpcServerCallHandler$MockedUnaryMethod.invoke(GrpcServerCallHandler.java:115)
at io.grpc.stub.ServerCalls$UnaryServerCallHandler$UnaryServerCallListener.onHalfClose(ServerCalls.java:182)
at io.grpc.internal.ServerCallImpl$ServerStreamListenerImpl.halfClosed(ServerCallImpl.java:351)
at io.grpc.internal.ServerImpl$JumpToApplicationThreadServerStreamListener$1HalfClosed.runInContext(ServerImpl.java:861)
at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133)
at [email protected]/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at [email protected]/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at [email protected]/java.lang.Thread.run(Thread.java:840)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:915)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:890)
Caused by: java.lang.UnsupportedOperationException: JsonObject
at com.google.gson.JsonElement.getAsString(JsonElement.java:187)
at com.google.protobuf.util.JsonFormat$ParserImpl.mergeTimestamp(JsonFormat.java:1538)`

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions