hyperf / service-governance-nacos

[READ ONLY] A nacos adapter for Hyperf service governance component.
MIT License
1 stars 7 forks source link

[ERROR] The nacos heartbeat failed, caused by JsonException: Syntax error in /data/wwwroot/node_provider_resource/vendor/hyperf/codec/src/Json.php:49 Stack trace: #0 /data/wwwroot/node_provider_resource/vendor/hyperf/codec/src/Json.php(49): json_decode() #1 /data/wwwroot/node_provider_resource/vendor/hyperf/service-governance-nacos/src/NacosDriver.php(229): Hyperf\Codec\Json::decode() #2 /data/wwwroot/node_provider_resource/vendor/hyperf/support/src/Functions.php(74): Hyperf\ServiceGovernanceNacos\NacosDriver->Hyperf\ServiceGovernanceNacos\{closure}() #3 /data/wwwroot/node_provider_resource/vendor/hyperf/service-governance-nacos/src/NacosDriver.php(255): Hyperf\Support\retry() #4 /data/wwwroot/node_provider_resource/vendor/hyperf/coroutine/src/Coroutine.php(68): Hyperf\ServiceGovernanceNacos\NacosDriver->Hyperf\ServiceGovernanceNacos\{closure}() #5 [internal function]: Hyperf\Coroutine\Coroutine::Hyperf\Coroutine\{closure}() #6 {main} #10

Open zx2020-07 opened 1 year ago

zx2020-07 commented 1 year ago
<?php
return [
    'enable' => [
        'discovery' => true,
        'register' => true,
    ],
    'consumers' => [],
    'providers' => [],
    'drivers' => [
        'nacos' => [
            // nacos server url like https://nacos.hyperf.io, Priority is higher than host:port
            // 'url' => '',
            // 这个地方需要注意,可能会导致启动失败
            'host' => '127.0.0.1',
            'port' => 8848,
            // 登录 nacos 的账号
            'username' => 'nacos',
            'password' => 'nacos',
            'guzzle' => [
                'config' => null,
            ],
            // 分组
            'group_name' => 'DEFAULT_GROUP',
            // 命名空间 ID
            'namespace_id' => 'public',
            'heartbeat' => 5,
            'ephemeral' => true, // 是否注册临时实例
        ],
    ],
];

开启注册临时实例,启动报错

zx2020-07 commented 1 year ago
string(47) "{"resultCode":200,"errorCode":0,"success":true}"
string(136) "caused: errCode: 400, errMsg: Current service DEFAULT_GROUP@@ResourceService is persistent service, can't register ephemeral instance. ;"
[ERROR] The nacos heartbeat failed, caused by JsonException: Syntax error in /data/wwwroot/node_provider_resource/vendor/hyperf/codec/src/Json.php:50
Stack trace:
#0 /data/wwwroot/node_provider_resource/vendor/hyperf/codec/src/Json.php(50): json_decode()
#1 /data/wwwroot/node_provider_resource/vendor/hyperf/service-governance-nacos/src/NacosDriver.php(229): Hyperf\Codec\Json::decode()
#2 /data/wwwroot/node_provider_resource/vendor/hyperf/support/src/Functions.php(74): Hyperf\ServiceGovernanceNacos\NacosDriver->Hyperf\ServiceGovernanceNacos\{closure}()
#3 /data/wwwroot/node_provider_resource/vendor/hyperf/service-governance-nacos/src/NacosDriver.php(255): Hyperf\Support\retry()
#4 /data/wwwroot/node_provider_resource/vendor/hyperf/coroutine/src/Coroutine.php(68): Hyperf\ServiceGovernanceNacos\NacosDriver->Hyperf\ServiceGovernanceNacos\{closure}()
#5 [internal function]: Hyperf\Coroutine\Coroutine::Hyperf\Coroutine\{closure}()
#6 {main}

先开启了持久化服务,然后改为临时服务,心跳检测出现json解析错误