在尝试从我的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' }