1

I'm having problem with this error protoreflect.ProtoMessage value in return statement: *HelloReply does not implement protoreflect.ProtoMessage (missing method ProtoReflect)

Indeed there is no ProtoReflect method in the generated files that command buf generate generated.

Well That's annoying because I've a blocker that blocks me to move foward in leanring grpc gateway.

Any idea? buf.yaml

version: v1
name: buf.build/shibbaz/grpc-app`

buf.gen.yaml

version: v1
plugins:
  - plugin: go
    out: proto
    opt: paths=source_relative
  - plugin: go-grpc
    out: proto
    opt: paths=source_relative

helloworld.proto

syntax = "proto3";
option go_package = "helloworld.proto";

package api;

import "google/api/annotations.proto";

// Here is the overall greeting service definition where we define all our endpoints
service Greeter {
  // Sends a greeting
  rpc SayHello (HelloRequest) returns (HelloReply) {
    option (google.api.http) = {
      post: "/v1/example/echo"
      body: "*"
    };
  }
}

// The request message containing the user's name
message HelloRequest {
  string name = 1;
}

// The response message containing the greetings
message HelloReply {
  string message = 1;
}

I'm expecting successful run of main.go file

Brits
  • 14,829
  • 2
  • 18
  • 31
Shibbaz
  • 11
  • 2
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Jul 20 '23 at 18:02
  • Generated this on my PC and `func (x *HelloReply) ProtoReflect() protoreflect.Message {` was generated without issue (did add `deps` for `buf.build/googleapis/googleapis` in `buff.yaml`). I'd guess you have old plugins - perhaps try replacing `- plugin: go` with `- plugin: buf.build/protocolbuffers/go:v1.31.0` – Brits Jul 21 '23 at 02:28

0 Answers0