area/dubbohelp wanted
Repository metrics
- Stars
- (9,036 個のスター)
- PR merge metrics
- (平均マージ 7d 9h) (30d で 18 merged PRs)
説明
If you are reporting any crash or any potential security issue, do not open an issue in this repo. Please report the issue via ASRC(Alibaba Security Response Center) where the issue will be triaged appropriately.
- I have searched the issues of this repository and believe that this is not a duplicate.
Ⅰ. Issue Description
http2dubbo验证接口多参数、多类型,java dubbo 服务的接口参数声明为 string 和 integer 时,会报错 given param not match the type .
Ⅱ. Describe what happened
java dubbo 服务的接口参数分别string 和 string 不会报错,string 和 Long 不会报错, string 和 integer 是会报错 can not transcode the request because the given param not match the type
If there is an exception, please attach the exception trace:
[Envoy (Epoch 0)] [2024-06-26 14:45:41.801][49][warning][filter] Failed to resolve headers, error is INVALID_ARGUMENT: can not transcode the request because the given param not match the type
{"authority":"localhost","bytes_received":"0","bytes_sent":"90","downstream_local_address":"172.23.0.7:80","downstream_remote_address":"172.23.0.1:59090","duration":"0","istio_policy_status":"-","method":"GET","path":"/dubbo/test?name=abcdddc&age=2","protocol":"HTTP/1.1","request_id":"381cf076-6c78-42d0-8159-d67c77fea2dc","requested_server_name":"-","response_code":"400","response_flags":"-","route_name":"-","start_time":"2024-06-26T14:45:41.801Z","trace_id":"-","upstream_cluster":"outbound|20880||providers:com.example.demo.dubbo.api.DemoService::.DEFAULT-GROUP.public.nacos","upstream_host":"-","upstream_local_address":"-","upstream_service_time":"-","upstream_transport_failure_reason":"-","user_agent":"curl/7.29.0","x_forwarded_for":"172.23.0.1"}
Ⅲ. Describe what you expected to happen
期望返回
{"result":"Hello abcdddc#2"}
Ⅳ. How to reproduce it (as minimally and precisely as possible)
- 申明dubbo接口
package com.example.demo.dubbo.api;
public interface DemoService {
String sayName(String name, Long age);
String sayHello(String name);
}
- 实现 dubbo 接口
package com.example.demo.dubbo.service;
import com.example.demo.dubbo.api.DemoService;
import org.apache.dubbo.config.annotation.DubboService;
@DubboService
public class DemoServiceImpl implements DemoService {
@Override
public String sayName(String name, Integer age ) {
return "Hello " + name + "#" + age;
}
@Override
public String sayHello(String name) {
return "Hello " + name;
}
}
- 部署 dubbo 服务到nacos, 并参考 http2dubbo,配好 http2dubbo 的路由和协议转换,其中CRD配置如下:
apiVersion: networking.higress.io/v1
kind: Http2Rpc
metadata:
name: httproute-http2rpc-demo
namespace: higress-system
spec:
dubbo:
service: com.example.demo.dubbo.api.DemoService
version:
group:
methods:
- serviceMethod: sayHello
headersAttach: "*"
httpMethods:
- "GET"
httpPath: "/dubbo/hello"
params:
- paramKey: name
paramSource: QUERY
paramType: "java.lang.String"
- serviceMethod: sayName
headersAttach: "*"
httpMethods:
- "GET"
httpPath: "/dubbo/test"
params:
- paramKey: name
paramSource: QUERY
paramType: "java.lang.String"
- paramKey: age
paramSource: QUERY
paramType: "java.lang.Integer"
- curl 命令验证
# 单个参数
curl "localhost/dubbo/hello?name=abcdddc"
#期待返回
{"result":"Hello abcdddc"}
# 多个参数,不同类型
curl "localhost/dubbo/test?name=abcdddc&age=2"
# 期待返回
{"result":"Hello abcdddc#2"}
Ⅴ. Anything else we need to know?
拉了 higress 主分支的源码,搜到如下信息:
Ⅵ. Environment:
- Higress version: 1.4.0
- OS : centos7
- Others: java、dubbo3服务使用dubbo协议