I have a NestJS GraphQL project deployed on Google Cloud Run. In addition to the GraphQL functionality, I call a gRPC microservice directly (outside of GraphQL), and it works perfectly on my local machine. However, when I deploy the project to Cloud Run and try the same operation, I encounter an error . The issue persists even though the JSON payload I am sending is very small. Any insights on what might be causing this?
@Injectable()
export class AdsStatisticsService implements OnModuleInit {
adsStatService: StatService;
constructor(@Inject('ADS_STATISTICS') private client: ClientGrpc) {}
onModuleInit() {
this.adsStatService = this.client.getService<StatService>('StatService');
}
insertAdsStat(request: InputInsert): Observable<string> {
return this.adsStatService.insertAdsStat(request);
}
}
// inside of request
request = {advertisementId:1, views:100, date:1734337800000}
Error like this:
8 RESOURCE_EXHAUSTED: Received message larger than max (1013478509 vs 209715200)
Implementations are available below:(.proto names are different but their contents are the same)
I tried all grpc data sending formats as much as nestjs allows but it didn’t work. What am I missing or doing wrong?
I increased the specs of my machine.
1
The root cause of this is a different HTTP error that is being masked by a RESOURCE_EXHAUSTED error.
This is the result of this bug: the gRPC library parses HTTP error responses as length-delimited messages, and the resulting parsed length is greater than the configured maximum (the default in this case).
This bug is fixed in @grpc/grpc-js
version 1.12.5.