fix(api-server): await all gRPC plugin registrations before bindAsync
Problem
startGrpcServer() used forEach(async ...) to register plugin gRPC services,
which does not await async callbacks. This caused bindAsync() to execute
before plugins called addService(), resulting in UNIMPLEMENTED errors
on all connector gRPC endpoints.
Additionally, plugin initialization failures surfaced as unhandled promise rejections, crashing Node.js ≥ 15.
Fix
- Replaced
forEach(async ...)withawait Promise.all(map(async ...)) - Ensured all plugin services are registered before calling
bindAsync() - Aligned implementation with
createCrpcServicesOfPlugins()pattern
Result
- Prevents race condition during server startup
- Ensures all gRPC services are properly registered
- Avoids unhandled promise rejections
Fixes #4162
Gentle ping for reviews — this fixes a race condition (#4162) where bindAsync() fires before plugins call addService(), causing "UNIMPLEMENTED" errors on gRPC connector endpoints. The fix aligns with the existing createCrpcServicesOfPlugins() pattern.
Would appreciate a second approval. @VRamakrishna @outSH
Please squash the commits into single commit
@sandeepnRES Done. Squashed all commits into one. Let me know if anything else is needed.
@LordKubaya This PR was already approved earlier. Re-requested review by mistake. No further changes since approval.