Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

code: 32603, message types.Coin is neither a v1 or v2 Message #1603

Closed
anilcse opened this issue Aug 18, 2020 · 1 comment
Closed

code: 32603, message types.Coin is neither a v1 or v2 Message #1603

anilcse opened this issue Aug 18, 2020 · 1 comment

Comments

@anilcse
Copy link

anilcse commented Aug 18, 2020

馃悰 Bug Report

Gateway integration is failing with following message while runtime.ForwardResponseMessage. Coin is a proto message in the reference code.

{
  "jsonrpc": "2.0",
  "id": -1,
  "error": {
    "code": -32603,
    "message": "Internal error",
    "data": "message types.Coin is neither a v1 or v2 Message"
  }
}

Reference integration code is here: https://github.com/cosmos/cosmos-sdk/blob/atheesh/5921-grpc-gateway-register/x/bank/module.go#L68
and it's failing here:
https://github.com/cosmos/cosmos-sdk/blob/atheesh/5921-grpc-gateway-register/x/bank/types/query.pb.gw.go#L315

resp contains the expected data but it is failing inside forward_Query_TotalSupply_0 in the example

To Reproduce

  1. git clone github.com/cosmos/cosmos-sdk && cd $GOPATH/src/github.com/cosmos/cosmos-sdk
  2. git checkout atheesh/5921-grpc-gateway-register
  3. go test x/bank/client/rest/query_test.go

Expected behavior

Should return the query response as resp here: https://github.com/cosmos/cosmos-sdk/blob/atheesh/5921-grpc-gateway-register/x/bank/types/query.pb.gw.go#L31

Actual Behavior

{
  "jsonrpc": "2.0",
  "id": -1,
  "error": {
    "code": -32603,
    "message": "Internal error",
    "data": "message types.Coin is neither a v1 or v2 Message"
  }
}

Looks like something to do with the Marshaler, any help would be really appreciated.

Your Environment

Go: 1.14
Ubuntu: 18.04
Gateway: v1.14.6

@anilcse anilcse changed the title message types.Coin is neither a v1 or v2 Message code: 32603, message types.Coin is neither a v1 or v2 Message Aug 18, 2020
@johanbrandhorst
Copy link
Collaborator

This implies some part of your code is using the new Go protobuf stack, and your generated Gogo protobuf messages are not working with it. I would search your codebase for uses of google.golang.org/protobuf and either remove them and keep using gogo protobuf, or migrate from gogo protobuf to the official generator. It's a somewhat complicated issue, and probably best covered in the support channel (#grpc-gateway on Gophers slack https://invite.slack.golangbridge.org/). This is not an issue with the gateway but a mismatch between the configured marshaler and the code generator used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants