Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
provideGrpcInterceptors
✓ import { provideGrpcInterceptors } from 'nx-grpc-kit'
✗ import { provideGrpcInterceptors } from 'nx-grpc-kit/interceptors'
The function is re-exported from the main entry point. Importing from 'nx-grpc-kit/interceptors' will not work.
withAuth
✓ import { withAuth } from 'nx-grpc-kit'
✗ const { withAuth } = require('nx-grpc-kit')
ESM-only. CommonJS require() will not work.
withRetry
✓ import { withRetry } from 'nx-grpc-kit'
✗ import { withRetry } from '@nx-grpc-kit/interceptors'
All interceptors are exported from the root package, not a subpath.
Configures Angular app providers with gRPC-web interceptors: Firebase auth, retry, deadline, dev tools, and error toasts.
import { provideGrpcInterceptors, withFirebaseAuth, withRetry, withDeadline, withDevTools, withToast } from 'nx-grpc-kit';
import { GrpcCoreModule, GrpcWebClientModule } from '@ngx-grpc/core';
import { importProvidersFrom } from '@angular/core';
import { environment } from '../environments/environment';
import { getAuth } from 'firebase/auth';
import { authStore } from './auth.store'; // assume defined
import { toastService } from './toast.service'; // assume defined
export const appConfig: ApplicationConfig = {
providers: [
importProvidersFrom(GrpcCoreModule.forRoot()),
importProvidersFrom(
GrpcWebClientModule.forRoot({ settings: { host: environment.grpcURL } }),
),
...provideGrpcInterceptors(
withFirebaseAuth({
getToken: () => getAuth().currentUser?.getIdToken() ?? Promise.resolve(null),
getMetadata: () => ({
orgid: authStore.selectedOrgId(),
propertyid: authStore.selectedPropId(),
}),
}),
withRetry({ maxRetries: 3 }),
withDeadline(15_000),
withDevTools({ enabled: !environment.production }),
withToast({ handler: (err) => toastService.showError(err.message) }),
),
],
};
Errors
Common errors & fixes
Cannot find module 'nx-grpc-kit' or its corresponding type declarations.
Missing `@angular/core` or other peer deps. TypeScript may not resolve the package.
fixInstall peer dependencies: `npm install @angular/core @ngx-grpc/core @ngx-grpc/common rxjs`
Module not found: Error: Can't resolve 'nx-grpc-kit/interceptors'
Importing from subpath that does not exist.
fixChange import to `nx-grpc-kit` (root package).
require() of ES Module nx-grpc-kit not supported.
Using CommonJS `require()` with an ESM-only package.
fixUse `import` syntax or set `"type": "module"` in package.json.
Audit
Dependencies
@angular/corerequiredPeer dependency: provides Angular injector and ApplicationConfig type.
@ngx-grpc/commonrequiredPeer dependency: gRPC-web common utilities.
@ngx-grpc/corerequiredPeer dependency: gRPC-web core module (GrpcCoreModule, GrpcWebClientModule).
rxjsrequiredPeer dependency: Observable-based gRPC client.