Skip to content

typing issue with custom grpc callOptions on single operation #187

@0xb4lamx

Description

@0xb4lamx

hey! I've faced few typing issues when trying to customize some grpc callOptions per operation.

details

considering that client is created via v1.NewClient() . a request with custom callOptions

    const response = await this.client.checkBulkPermissions(
      checkBulkPermissionsRequest,
      undefined,
      { deadline: Date.now() + config.SPICEDB_GRPC_TIMEOUT_MS }
    );

will build fine, but on runtime, gRPC calls will fail with:

 Trace: Error: Incorrect arguments passed
        at Proxy.checkOptionalUnaryResponseArguments (/xxxxxxx/api/node_modules/.pnpm/@[email protected]/node_modules/@grpc/grpc-js/src/client.ts:229:15)
        at Proxy.makeUnaryRequest (/xxxxxxx/api/node_modules/.pnpm/@[email protected]/node_modules/@grpc/grpc-js/src/client.ts:277:12)
        at Proxy.checkBulkPermissions 

==
but doing it this way

    const response = await this.client.checkBulkPermissions(
      checkBulkPermissionsRequest,
      { deadline: Date.now() + config.SPICEDB_GRPC_TIMEOUT_MS }
    );

works fine, but will TS type fail 🤔

env

"@authzed/authzed-node": "^1.1.1",
"typescript": "5.4.4",
node v22

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