5.8.4 ExHook连接失败

2025-02-23T22:13:51.365097+08:00 [error] [grpc_client] connect to {“https”,“172.19.26.137”,5001} failed: {options,incompatible,[{verify,verify_peer},{cacerts,undefined}]}

2025-02-23T22:13:51.466161+08:00 [error] msg: exhook_call_error, function: on_provider_loaded, module: emqx_exhook_v_2_hook_provider_client, reason: {options,incompatible,[{verify,verify_peer},{cacerts,undefined}]}, options: #{timeout => 5000,channel => <<“exhook”>>,key_dispatch => <0.2824.0>,failed_action => deny}, req: #{meta => #{node => <<“emqx@127.0.0.1”>>,version => “5.8.4”,cluster_name => “emqxcl”,sysdescr => “EMQX”},broker => #{version => “5.8.4”,uptime => 369722760,sysdescr => “EMQX”,datetime => “2025-02-23T22:13:51.264390602+08:00”}}

2025-02-23T22:13:51.466682+08:00 [error] msg: failed_to_load_exhook_callback_server, name: <<“exhook”>>, reason: {options,incompatible,[{verify,verify_peer},{cacerts,undefined}]}

grpc proto 是 package emqx.exhook.v2;
emqx 是开源版 5.8.4
grpc服务是正常的我用postman测试没有问题,用 [5.4.1]的emqx测试也可以连接上exhook服务

这个日志是说,开了双向认证,但是没填 ca 证书

感谢您的回复!

你提到的那个双向认证是 exHook配置里的 启用TLS 和 验证服务器证书么?
如果是的话,Ddashboard里那个两开关我可以确认是关闭的。
如果不是,那个双向谁是在那里配置的呢?



试试把这 2 个关掉。
然后用这个命令看看配置:
./bin/emqx ctl conf show exhook

image
最下面一行是url,我给隐藏了

这个配置没有问题,现在还是报一样的错么?[{verify,verify_peer},{cacerts,undefined}]}
如果还报这个错,那就是 bug,可以到 https://github.com/emqx/emqx/issues 上提个issue

是的呢,一直提示这个。

2025-02-25T09:58:12.365910+08:00 [error] [grpc_client] connect to {“https”,“exhook.mqtt.ylzn.cc”,5001} failed: {options,incompatible,[{verify,verify_peer},{cacerts,undefined}]}
2025-02-25T09:58:12.365968+08:00 [error] [grpc_client] connect to {“https”,“exhook.mqtt.ylzn.cc”,5001} failed: {options,incompatible,[{verify,verify_peer},{cacerts,undefined}]}
2025-02-25T09:58:12.366048+08:00 [error] [grpc_client] connect to {“https”,“exhook.mqtt.ylzn.cc”,5001} failed: {options,incompatible,[{verify,verify_peer},{cacerts,undefined}]}
2025-02-25T09:58:12.366119+08:00 [error] [grpc_client] connect to {“https”,“exhook.mqtt.ylzn.cc”,5001} failed: {options,incompatible,[{verify,verify_peer},{cacerts,undefined}]}
2025-02-25T09:58:12.467050+08:00 [error] msg: exhook_call_error, function: on_provider_loaded, module: emqx_exhook_v_2_hook_provider_client, reason: {options,incompatible,[{verify,verify_peer},{cacerts,undefined}]}, options: #{timeout => 5000,channel => <<“exhook”>>,key_dispatch => <0.2824.0>,failed_action => deny}, req: #{meta => #{node => <<“emqx@127.0.0.1”>>,version => “5.8.4”,cluster_name => “emqxcl”,sysdescr => “EMQX”},broker => #{version => “5.8.4”,uptime => 498383761,sysdescr => “EMQX”,datetime => “2025-02-25T09:58:12.265333650+08:00”}}
2025-02-25T09:58:12.467586+08:00 [error] msg: failed_to_load_exhook_callback_server, name: <<“exhook”>>, reason: {options,incompatible,[{verify,verify_peer},{cacerts,undefined}]}

有一个疑问,为什么你url 里面用了 https,但是不需要 ssl?
(我还以为你用的是 http 呢)
我们一般都是用了 https,就会直接ssl.enable = true,但是 verify=veify_none 这样配合用的。

我用https把证书上传的也连接不上,
我看资料grpc用的是http2,然后http2必须要用https,所以没有开启tls

我用http也连接不上,你稍等,我把连接不上的消息,贴上来

你不是都说已经连上了。。。
是不是要用 https 取决于你的 grpc 服务的实现,不需要在 emqx 全试过遍所有可能的配置。他需要你就配置,不需要就不需要配。

2025-02-25T10:11:00.562474+08:00 [warning] [gRPC Client] Unknown stream ref: {connection_error,protocol_error,‘Invalid connection preface received. Appears to be an HTTP/1 response? (RFC7540 3.5)’}, event: {gun_error,<0.462826.0>,{connection_error,protocol_error,‘Invalid connection preface received. Appears to be an HTTP/1 response? (RFC7540 3.5)’}}
2025-02-25T10:11:00.562623+08:00 [error] msg: exhook_call_error, function: on_provider_loaded, module: emqx_exhook_v_2_hook_provider_client, reason: {connection_down,{error,{connection_error,protocol_error,‘Invalid connection preface received. Appears to be an HTTP/1 response? (RFC7540 3.5)’}}}, options: #{timeout => 5000,channel => <<“exhook”>>,key_dispatch => <0.2824.0>,failed_action => deny}, req: #{meta => #{node => <<“emqx@127.0.0.1”>>,version => “5.8.4”,cluster_name => “emqxcl”,sysdescr => “EMQX”},broker => #{version => “5.8.4”,uptime => 499152054,sysdescr => “EMQX”,datetime => “2025-02-25T10:11:00.557841372+08:00”}}
2025-02-25T10:11:00.563199+08:00 [error] msg: failed_to_load_exhook_callback_server, name: <<“exhook”>>, reason: {connection_down,{error,{connection_error,protocol_error,‘Invalid connection preface received. Appears to be an HTTP/1 response? (RFC7540 3.5)’}}}
这 版本信息:[5.8.4 (Open Source)] http的报错

然后如下图如示的配置,在5.4.1里面连接同样的一个grpc exhook是可以连接上的

麻烦分别在5.8.4 和 5.4.1 上都运行一下:
./bin/emqx ctl conf show exhook

大概率是有什么改动不兼容:

好的,我试了之后再来反馈。