question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

gRPC client streaming typescript not created.

See original GitHub issue

Minimal protobuf example:

syntax = "proto3";

package filestream;

service FileService {
  rpc FileUploadCommand(stream FileUploadCommandRequest)
      returns (FileUploadCommandResponse) {}
  rpc FileDownloadCommand(FileDownloadCommandRequest)
      returns (stream FileDownloadCommandResponse) {}
}

enum FileCommand {
  FILE_UPLOAD = 0;
  FILE_DOWNLOAD = 1;
}

message FileContent {
  string filename = 1;
  bytes filecontent = 2;
}

message FileUploadCommandRequest { FileContent filecontent = 1; }

message FileUploadCommandResponse {
  string filename = 1;
  int64 filesize = 2;
}

message FileDownloadCommandRequest { string filename = 1; }

message FileDownloadCommandResponse { FileContent filecontent = 1; }

gRPC version: 1.48.1

protoc --version
libprotoc 3.19.4

protoc-gen-grpc-web version: 1.3.1-linux-x86_64

Command:

protoc -I=$DIR file.proto \
    --js_out=import_style=commonjs:$OUT_DIR \
    --grpc-web_out=import_style=typescript,mode=grpcwebtext:$OUT_DIR

Output:

/**
 * @fileoverview gRPC-Web generated client stub for filestream
 * @enhanceable
 * @public
 */

// GENERATED CODE -- DO NOT EDIT!


/* eslint-disable */
// @ts-nocheck


import * as grpcWeb from 'grpc-web';

import * as file_pb from './file_pb';


export class FileServiceClient {
  client_: grpcWeb.AbstractClientBase;
  hostname_: string;
  credentials_: null | { [index: string]: string; };
  options_: null | { [index: string]: any; };

  constructor (hostname: string,
               credentials?: null | { [index: string]: string; },
               options?: null | { [index: string]: any; }) {
    if (!options) options = {};
    if (!credentials) credentials = {};
    options['format'] = 'text';

    this.client_ = new grpcWeb.GrpcWebClientBase(options);
    this.hostname_ = hostname;
    this.credentials_ = credentials;
    this.options_ = options;
  }

  methodDescriptorFileDownloadCommand = new grpcWeb.MethodDescriptor(
    '/filestream.FileService/FileDownloadCommand',
    grpcWeb.MethodType.SERVER_STREAMING,
    file_pb.FileDownloadCommandRequest,
    file_pb.FileDownloadCommandResponse,
    (request: file_pb.FileDownloadCommandRequest) => {
      return request.serializeBinary();
    },
    file_pb.FileDownloadCommandResponse.deserializeBinary
  );

  fileDownloadCommand(
    request: file_pb.FileDownloadCommandRequest,
    metadata?: grpcWeb.Metadata): grpcWeb.ClientReadableStream<file_pb.FileDownloadCommandResponse> {
    return this.client_.serverStreaming(
      this.hostname_ +
        '/filestream.FileService/FileDownloadCommand',
      request,
      metadata || {},
      this.methodDescriptorFileDownloadCommand);
  }

}

Expectations: expected fileUploadCommand to be generated.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8

github_iconTop GitHub Comments

2reactions
opporancisiscommented, Sep 12, 2022

Hi @kkuehl , I think that the client streaming is still not supported.
Look also: a ticket about the same topic and the roadmap.

1reaction
kkuehlcommented, Sep 13, 2022

Feel free to close ticket.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to implement a gRPC client and server in TypeScript
How to achieve the perfect TypeScript + gRPC server and client ... First, we'll create our service definition in proto/songs.proto .
Read more >
Use gRPC with Node.js and Typescript - DEV Community ‍ ‍
And in this article, I am going to teach you how you can use gRPC to create high-performance RPC apps using node.js and...
Read more >
Implementing a gRPC client and server in Typescript with Node
TypeScript brings many benefits to JavaScript. In this video, we will look at using gRPC to generate TypeScript files for interacting with a ......
Read more >
Creating your gRPC w/ Protobuf Server in Node/Typescript ...
Hello viewers!Welcome back to my channel! In part 2 we are going to be creating our client which will be communicating with our...
Read more >
Basics tutorial | Node - gRPC
The client reads from the returned stream until there are no more messages. ... First let's look at how we create a RouteGuide...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found