【问题标题】:SSL error when creating vue.js app using api platform client generator使用 api 平台客户端生成器创建 vue.js 应用程序时出现 SSL 错误
【发布时间】:2019-09-30 13:59:43
【问题描述】:

我尝试创建使用 API 平台创建的 API 的客户端应用程序。我遵循本指南https://api-platform.com/docs/client-generator/vuejs/

  • 我在开发 VM 时使用 Laravel Homestead。
  • 我已将 myapp .crt 文件添加到 Keychan Access。

问题是,当我尝试执行时

generate-api-platform-client --generator vue https://myapp-api.local/api src/

它返回如下错误消息:

{
  api: Api { entrypoint: 'https://myapp-api.local/api', resources: [] },
  error: FetchError: request to https://myapp-api.local/api failed, reason: unable to verify the first certificate
      at ClientRequest.<anonymous> (/Users/permana.jayanta/.config/yarn/global/node_modules/node-fetch/index.js:133:11)
      at ClientRequest.emit (events.js:209:13)
      at TLSSocket.socketErrorListener (_http_client.js:406:9)
      at TLSSocket.emit (events.js:209:13)
      at emitErrorNT (internal/streams/destroy.js:91:8)
      at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
      at processTicksAndRejections (internal/process/task_queues.js:80:21) {
    name: 'FetchError',
    message: 'request to https://myapp-api.local/api failed, reason: unable to verify the first certificate',
    type: 'system',
    errno: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE',
    code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE'
  },
  response: undefined,
  status: undefined
}

我认为这与 SSL 证书有关。该节点无法识别证书。如何让node.js识别Homestead生成的自定义SSL证书?

【问题讨论】:

  • 这是如何解决的?
  • 同样的问题,由 API Platform docker 映像生成的 SSL 证书(并在我的钥匙串中手动添加)

标签: homestead api-platform.com symfony-4.3


【解决方案1】:

它未能验证 https 签名。 要禁用它,请输入 shell

 export NODE_TLS_REJECT_UNAUTHORIZED=0

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-09-13
    • 2013-01-15
    • 2014-05-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-25
    相关资源
    最近更新 更多