调用Google Map API时证书链中的自签名证书

时间:2019-05-05 18:03:11

标签: node.js ssl ssl-certificate

在尝试从我的nodejs示例学习项目中调用google map API时,将自签名证书置于证书链错误中

const fetch = require('node-fetch');

    fetch('http://maps.googleapis.com/maps/api/directions/json?destination=lingampally%2Chyderabad&key=API_KEYc&origin=kothaguda%2Chdyerabad')
    .then((res) => { console.log('res--------', res);})
    .then(json => console.log(json));

错误:

{ Error: self signed certificate in certificate chain
     at TLSSocket.<anonymous> (_tls_wrap.js:1116:38)
     at emitNone (events.js:106:13)
     at TLSSocket.emit (events.js:208:7)
     at TLSSocket._finishInit (_tls_wrap.js:643:8)
     at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:473:38) 
code: 'SELF_SIGNED_CERT_IN_CHAIN' }

0 个答案:

没有答案