Permana
Permana

Reputation: 1991

SSL error when creating vue.js app using api platform client generator

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/.

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?

Upvotes: 3

Views: 714

Answers (1)

Maxim
Maxim

Reputation: 91

It failed to verify https signature.

To disable it, type in shell

export NODE_TLS_REJECT_UNAUTHORIZED=0

Upvotes: 0

Related Questions