go-kratos / kratos

Your ultimate Go microservices framework for the cloud-native era.
https://go-kratos.dev
MIT License
22.73k stars 3.95k forks source link

HTTPClient proto: syntax error (line 1:1): unexpected token 404 #3333

Open aide-cloud opened 1 month ago

aide-cloud commented 1 month ago

kratos version: v2.7.3

proto file

syntax = "proto3";

package api.rabbit.hook;

import "google/api/annotations.proto";

option go_package = "github.com/aide-cloud/moon/api/rabbit/hook;hook";
option java_multiple_files = true;
option java_package = "api.rabbit.hook";

// 用于接受外界需要推送的消息
service Hook {
  // 发送消息, 用于接受http数据
  rpc SendMsg (SendMsgRequest) returns (SendMsgReply) {
    option (google.api.http) = {
      post: "/v1_rabbit_send_msg"
      body: "*"
    };
  }
}

message SendMsgRequest {
  // 用于接收外界的数据, 兼容所有json格式
  string json_data = 1;
  // 用于匹配该数据发送给谁
  string route = 2;
}
message SendMsgReply {
  // 发送的结果
  string msg = 1;
  // 状态码
  int32 code = 2;
  // 发送时间
  string time = 3;
}

HTTPClient

hookapi.NewHookHTTPClient(l.httpClient).SendMsg(ctx, in, httpOpts...)

error info

error: code = 404 reason =  message =  metadata = map[] cause = proto: syntax error (line 1:1): unexpected token 404
kratos-ci-bot commented 1 month ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


kratos version: v2.7.3

proto file

syntax = "proto3";

package api.rabbit.hook;

import "google/api/annotations.proto";

option go_package = "github.com/aide-cloud/moon/api/rabbit/hook;hook";
option java_multiple_files = true;
option java_package = "api.rabbit.hook";

// Used to accept messages that need to be pushed from the outside world
service Hook {
  //Send message, used to receive http data
  rpc SendMsg (SendMsgRequest) returns (SendMsgReply) {
    option (google.api.http) = {
      post: "/v1_rabbit_send_msg"
      body: "*"
    };
  }
}

message SendMsgRequest {
  // Used to receive external data, compatible with all json formats
  string json_data = 1;
  // Used to match who the data is sent to
  string route = 2;
}
message SendMsgReply {
  //Result sent
  string msg = 1;
  // status code
  int32 code = 2;
  //Send time
  string time = 3;
}

HTTPClient

hookapi.NewHookHTTPClient(l.httpClient).SendMsg(ctx, in, httpOpts...)

error info

error: code = 404 reason = message = metadata = map[] cause = proto: syntax error (line 1:1): unexpected token 404
aide-cloud commented 1 month ago

image

image

我还发现个有趣的问题, 拉下来的包和实际的不一致, 少了一段代码块

kratos-ci-bot commented 1 month ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


image

image

I also found an interesting problem. The pulled package is inconsistent with the actual one. There is a missing code block.