gRPC errors in nice-grpc-web come back as undefined in angular 18 in optimized builds with zonejs
Opened this issue · 0 comments
I'm not sure when this may have crept in, but I'm noticing that gRPC errors sent back from Envoy are being thrown as from the gRPC stub as undefined instead of ClientError when they come back from a nice-grpc-web method stub. gRPC errors come back correctly for the exact same gRPC request and response (as viewed in network inspector panel) if you aren't in angular prod build, with optimizations, or with zonejs all at once.
This occurs with:
Angular 18 with @angular-devkit/build-angular:application.
prod build mode (optimizations = true)
zonejs
If I switch off zonejs or optimizations, then nice-grpc-web stubs return gRPC errors like normal.
I got a hint to try turning off zonejs because I found that the stack trace was so incredibly obfuscated in my browser, even when I enabled sourcemaps. Fortunately angular 18 is the first version that (mostly) supports zoneless. Once I turned it off, I noticed that gRPC ClientErros are being thrown properly again.
I suspect that there's a chance this is more of a zonejs issue than a nice-grpc issue, but in either case even if this gets closed, I wanted to drop my experience here in case anyone else is searching for a similar issue.