我想在firebase函数中运行cURL,当前代码如下:
const URL = 'https://api.bitbucket.org/2.0/repositories/user/branch/pipelines/';
const auth = new Buffer(`${USER}:${PWD}`).toString('base64');
const headers = {
Authorization: `Basic ${auth}`,
'Content-Type': 'application/json',
};
const options = {
method: 'POST',
uri: URL,
headers,
body: datas,
json: true,
};
exports.myRun = functions.https.onRequest((req, res) => {
return cors(req, res, () => {
request(options, (error, response) => {
console.log(error, response.body);
});
res.status(200).send();
});
});
跑步后出现此错误,我不明白为什么
{ Error: getaddrinfo ENOTFOUND api.bitbucket.org api.bitbucket.org:443
at errnoException (dns.js:28:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:76:26)
code: 'ENOTFOUND',
errno: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'api.bitbucket.org',
host: 'api.bitbucket.org',
port: 443 }
有人可以帮我吗?