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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kitex服务端设置了GRPC协议,客户端调用报错Not Found: HTTP status code 404 #1586

Open
zhouguanglong1 opened this issue Oct 24, 2024 · 4 comments

Comments

@zhouguanglong1
Copy link

zhouguanglong1 commented Oct 24, 2024

前提:使用kitex框架,客户端和服务端通信,使用grpc协议

  1. kitex服务端如果是本地启动,在客户端设置client.WithHostPorts(addrs...),可以正常GRPC请求
  2. kitex服务端通过容器化部署,通过域名+端口暴露出来一个入口(入口大概是这样:a.b.c:8088),单独在postman打过去调用是没问题的,此时在客户端通过client.WithHostPorts(addrs...)初始化的,发起GRPC调用就会报以下的错误
Not Found: HTTP status code 404; transport: missing content-type field

请问初始化客户端时,需要调整什么参数,才能顺利打到服务端,目前是这些参数

client.WithTransportProtocol(transport.GRPC),
		client.WithRPCTimeout(time.Second * 3),
		client.WithConnectTimeout(time.Millisecond * 500),
		client.WithFailureRetry(retry.NewFailurePolicy()),
		client.WithErrorHandler(ClientErrorHandler),
		client.WithGRPCKeepaliveParams(grpc.ClientKeepalive{ // 只有GRPC才可以使用
			Time:                ktime,
			Timeout:             ktimeout,
			PermitWithoutStream: permitWithoutStream,
		}),
                 client.WithHostPorts(addrs...),
@DMwangnima
Copy link
Contributor

这个就是完整的报错信息么?在 NewStream 时报的错?
Not Found: HTTP status code 404; transport: missing content-type field

@zhouguanglong1
Copy link
Author

在客户端调用相关的RPC接口的时候的报错

@Marina-Sakai
Copy link
Contributor

@zhouguanglong1 Is this the complete error message? May I see how you print the error message?

@zhouguanglong1
Copy link
Author

@Marina-Sakai
this is RPC request:

func (p *kFeeServiceClient) UserTradeInfo(ctx context.Context, Req *fee.Request, callOptions ...callopt.Option) (r *fee.Response, err error) {
	ctx = client.NewCtxWithCallOptions(ctx, callOptions)
	return p.kClient.UserTradeInfo(ctx, Req)
}

and it returns error
Not Found: HTTP status code 404; transport: missing content-type field

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

No branches or pull requests

3 participants