Skip to content

dfx 端口不一致导致 ping 失败的问题 #4249

@Billyblingbling

Description

@Billyblingbling

dfx 端口不一致导致 ping 失败的问题

问题描述

使用 dfx 0.26.1 版本时遇到 replica 端口不一致的问题,导致无法正常连接本地节点。

复现步骤

  1. 安装并使用 dfx 0.26.1 版本
  2. 执行启动命令:
    dfx start --clean --replica
  3. 得到成功启动提示:
    Running dfx start for version 0.26.1
    Using the default configuration for the local shared network.
    Replica API running on 127.0.0.1:4943. You must open a new terminal to continue developing. If you'd prefer to stop, quit with 'Ctrl-C'.
    
  4. 在新终端中执行 ping 命令:
    dfx ping

错误信息

Error: Failed while waiting for agent status.
Caused by: The replica returned an HTTP Error: Http Error: status 502 Bad Gateway, content type "text/plain; charset=utf-8", content: ConnectionFailure: HTTP request failed: error sending request for url (http://localhost:50882/api/v2/status)

问题分析

启动提示显示 replica API 运行在 127.0.0.1:4943,但 dfx ping 却尝试连接到 localhost:63009,导致端口不一致,无法正常通信。

系统环境

  • dfx 版本: 0.26.1
  • 操作系统: [请补充您的操作系统信息]
  • 其他相关环境信息: [如有其他相关信息请补充]

期望的行为

dfx ping 应该使用与 dfx start 输出中相同的端口(4943)进行通信,或者提供明确的配置方法来解决这一不一致问题。

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triageThis ticket needs investigation.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions