You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Docker部署NestJS应用遇Aries Framework Indy连接错误求助

Docker中NestJS应用连接Indy账本池失败问题

问题现象

  • 非Docker环境下NestJS应用运行完全正常,Docker环境中连接账本池BCOVRIN_TEST_GENESIS失败
  • 触发IndySdkError,具体错误为CommonInvalidStructure(indyCode:113),同时伴随PoolLedgerNotCreatedError
  • 尝试直接传入genesis tx、使用genesis url两种方式,均出现相同错误

错误日志详情

DEBUG: Starting HTTP inbound transport {
  "port": 8000
}
DEBUG: Starting HTTP outbound transport
DEBUG: Mediator routing record not loaded yet, retrieving from storage
DEBUG: Connecting to ledger pool 'BCOVRIN_TEST_GENESIS' {
  "genesisPath": "/tmp/afj/genesis-BCOVRIN_TEST_GENESIS.txn"
}
DEBUG: Pool 'BCOVRIN_TEST_GENESIS' does not exist yet, creating. {
  "indyError": "PoolLedgerNotCreatedError"
}
ERROR: Connection to pool: /tmp/afj/genesis-BCOVRIN_TEST_GENESIS.txn failed. {
  "error": {
    "name": "IndySdkError",
    "message": "IndyError(CommonInvalidStructure): CommonInvalidStructure",
    "stack": "IndySdkError: IndyError(CommonInvalidStructure): CommonInvalidStructure
   at IndyPool.connectToLedger (/app/node_modules/@aries-framework/core/build/modules/ledger/IndyPool.js:84:52)",
    "cause": {
      "name": "IndyError",
      "stack": "IndyError: CommonInvalidStructure
   at Object.callback (/app/node_modules/indy-sdk/src/wrapIndyCallback.js:15:10)",
      "message": "CommonInvalidStructure",
      "indyCode": 113,
      "indyName": "CommonInvalidStructure",
      "indyCurrentErrorJson": null
    }
  }
}
WARN: Error connecting to ledger, will try to reconnect when needed. {
  "error": {
    "name": "IndySdkError",
    "message": "IndyError(CommonInvalidStructure): CommonInvalidStructure",
    "stack": "IndySdkError: IndyError(CommonInvalidStructure): CommonInvalidStructure
   at IndyPool.connectToLedger (/app/node_modules/@aries-framework/core/build/modules/ledger/IndyPool.js:84:52)",
    "cause": {
      "name": "IndyError",
      "stack": "IndyError: CommonInvalidStructure
   at Object.callback (/app/node_modules/indy-sdk/src/wrapIndyCallback.js:15:10)",
      "message": "CommonInvalidStructure",
      "indyCode": 113,
      "indyName": "CommonInvalidStructure",
      "indyCurrentErrorJson": null
    }
  }
}

排查与解决方向

  • 校验genesis文件格式与完整性:
    对比容器内/tmp/afj/genesis-BCOVRIN_TEST_GENESIS.txn文件与本地正常运行环境的文件,确保内容完全一致,无换行符错误、编码异常(如UTF-8 BOM)或语法错误,Indy对genesis文件的结构要求极为严格,任何微小偏差都会触发CommonInvalidStructure错误。
  • 检查文件权限:
    确保Docker容器内/tmp/afj/目录及对应的genesis文件拥有可读权限,避免Indy SDK因权限不足无法读取文件内容。
  • 对齐Indy SDK版本:
    确认Docker镜像中安装的Indy SDK版本与本地环境完全一致,不同版本的SDK对genesis文件的解析逻辑可能存在差异。
  • 验证网络连通性:
    若使用genesis url方式获取文件,检查Docker容器是否能正常访问该URL对应的服务器,网络不通导致文件下载不完整也可能引发结构错误。
  • 调整临时文件目录:
    若使用本地目录映射到容器/tmp/afj/,尝试取消映射,直接在容器内部生成或复制正确的genesis文件,排除映射过程中文件损坏的可能。

内容的提问来源于stack exchange,提问作者Lobo1897

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.15 07:20:02