我已经尝试了这个线程上的所有东西,但没有运气。 Node.js https pem 错误:routines:PEM_read_bio:no start line
我正在尝试向 google API 发出一个非常简单的请求,以询问频道的信息。
我有的东西:
- 已安装 npm 请求
- 谷歌 API 密钥 - 导出到环境变量
- 我正在使用 cloud9(这就是为什么其他解决方案可能不起作用的原因)
我可以使用相同的方法向 yahoo 天气 API 发出请求。
var request = require('request');
request("https://www.googleapis.com/youtube/v3/channels?",{
part: "snippet,contentDetails,statistics",
id: "UCd534c_ehOvrLVL2v7Nl61w",
key: process.env.YOUTUBE_API_KEY
}, function(err, response, body){
if (err){
console.log(err);
}
console.log(body);
});
这是完整的错误
Error: error:0906D06C:PEM routines:PEM_read_bio:no start line
at Error (native)
at Object.createSecureContext (_tls_common.js:85:17)
at Object.exports.connect (_tls_wrap.js:1033:48)
at Agent.createConnection (https.js:82:22)
at Agent.createSocket (_http_agent.js:195:26)
at Agent.addRequest (_http_agent.js:157:10)
at new ClientRequest (_http_client.js:160:16)
at Object.exports.request (http.js:31:10)
at Object.exports.request (https.js:202:15)
at Request.start
(/home/ubuntu/workspace/node_modules/request/request.js:748:32)
undefined
谢谢您的帮助!