3

I tried to create client app of my API created using API Platform. I follow this guide https://api-platform.com/docs/client-generator/vuejs/.

  • I use Laravel Homestead for the VM when developing it.
  • I've added myapp .crt file to Keychan Access.

Problem was, when I try to execute

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

It return error message like this:

{
  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
}

I'm thinking this is related with SSL certificate. That node doesn't recognise the certificate. How to make node.js recognise the custom SSL certificate generated by Homestead?

Permana
  • 1,972
  • 2
  • 33
  • 51

1 Answers1

0

it failed to verify https signature. To disable it, type in shell

 export NODE_TLS_REJECT_UNAUTHORIZED=0
Maxim
  • 81
  • 9