gpt4 book ai didi

对 api.bitbucket.org 的 Node.js SSL/HTTPS 请求出现奇怪的 ssl 错误

转载 作者:太空宇宙 更新时间:2023-11-03 14:26:54 24 4
gpt4 key购买 nike

我收到这个奇怪的错误:

Making request to bitbucket api at path: /2.0/repositories/interos/eco-system-globe/commit/116c82c81b8d3e1b8c2fd3f352510fd09e66a02e
***Request stream error***: Error: write EPROTO 139717438125888:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:332:

at WriteWrap.onWriteComplete [as oncomplete] (internal/stream_base_commons.js:83:16) {
errno: 'EPROTO',
code: 'EPROTO',
syscall: 'write'
}

我的代码很简单:

 const pth = `/2.0/repositories/${fullRepoName}/commit/${sha}`;

console.log('Making request to bitbucket api at path:',pth);

const newReq = https.get({ // formerly get
protocol: 'https:',
port: 80,
hostname: 'api.bitbucket.org',
path: pth,
headers: {

'Authorization': `Basic ${bitbucketBase64}`,
'Auth': `Basic ${bitbucketBase64}`
}

}, r => {


const v = {
data: ''
};

r.on('data', d => {
v.data += String(d || '');
});

r.once('end', () => {

console.log('response ended:', r.statusCode);
cb(null, v);

});

});


newReq.once('error', e => {
console.error('***Request stream error***:', e);
});

// newReq.write(stringified);
newReq.end();

有人知道这是怎么回事吗?我使用的是 Node.js 版本 12.2.0

最佳答案

我有 port: 80 但它应该是 port: 443 ...对于 SSL 这是默认设置,所以你可以省略端口参数。

关于对 api.bitbucket.org 的 Node.js SSL/HTTPS 请求出现奇怪的 ssl 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56248270/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com