Symfony集成Mercure失败:无法发送Update请求求助
Mercure与Symfony互通配置问题
已尝试2天配置Mercure与Symfony项目实现互通,Mercure服务器部署在Nginx后的容器中,curl命令可正常发送请求:
curl -d 'topic=https://example.com/books/1' -d 'data={"foo": "updated value"}' -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJtZXJjdXJlIjp7InB1Ymxpc2giOlsiKiJdfX0.5zgB1OBh7fwae_97lhU-3u59c2z0Q0vknvN3zuP7yfs' -X POST -k https://10.145.90.xxx/mercure
返回结果:
urn:uuid:d6dcf0b5-9c87-4ef0-9400-e9496bbe71b6
Symfony项目的.env配置:
MERCURE_PUBLIC_URL=https://10.145.90.xxx/mercure MERCURE_URL=https://10.145.90.xxx/mercure MERCURE_JWT_SECRET="2gtdpkx8AzLL0FBsCBmKEa66qIrccMW6LeRX"
Mercure配置(默认):
mercure: hubs: default: url: '%env(MERCURE_URL)%' public_url: '%env(MERCURE_PUBLIC_URL)%' jwt: secret: '%env(MERCURE_JWT_SECRET)%' publish: '*'
框架已配置跳过证书校验:
framework: ... http_client: default_options: verify_peer: false
curl可正常收发数据,但Symfony中发送Update时报错:
"Handling \"Symfony\\Component\\Mercure\\Update\" failed: Failed to send an update."
Update构建代码:
$update = new Update( $entity->mercureTopic(), json_encode([ 'user' => $user === null ? 'UNDEFINED' : $user->getUserIdentifier(), 'action' => 'version_incremented', 'orderId' => $entity->getId() ]) ); $this->getMessageBus()->dispatch($update);
请问可能遗漏了什么配置?如何查看更详细的错误信息?
内容的提问来源于stack exchange,提问作者Fpasquer
相关产品推荐
相关产品推荐

