0
Firebase 용 Cloud 기능을 통합하기 위해 요청 기능 및 tryng이 있습니다. 내가 잘못Firebase 오류 클라우드 기능 : getaddrinfo ENOTFOUND
Error: Error: getaddrinfo ENOTFOUND usxx.api.mailchimp.com usxx.api.mailchimp.com:443
을 뭐하는 거지 : 다음
var http = require("https");
function addUserToMailchimpList(email) {
var options = { method: 'POST',
url: 'https://usxx.api.mailchimp.com/3.0/lists/xxxxxxx/members/',
headers:
{ 'content-type': 'application/json',
'user' : 'anystring:xxxxxxxxxxxxxxxxxxxxxxx'
},
body:
{ email_address: email,
status: 'subscribed',
},
json: true };
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
console.log(error);
console.loh(response);
});
}
나는 폭을
exports.sendWelcomeEmail = functions.auth.user().onCreate(event => {
const user = event.data; // The Firebase user.
const email = user.email; // The email of the user.
const displayName = user.displayName; // The display name of the user.
return addUserToMailchimpList(email);
});
하지만 중포 기지 기능에
내가 오류가 발생하고 로그이 기능을 배포하는 tryng 무엇입니까? undestand .. 아닌가요?내가 사용하는 tryng하고 다른 방법하지만 같은 오류
function addUserToMailchimpList(email) {
var options = {
"method": "POST",
"hostname": "usxx.api.mailchimp.com",
"port": null,
"path": "/3.0/lists/xxxxx/members/",
"headers": {
"content-type": "application/json",
"user": "anystring:xxxxxxxxxx",
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function() {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({ email_address: email,
status: 'subscribed',
merge_fields: { FNAME: 'xxx', LNAME: 'xxx' } }));
req.end();
}
'usxx.api.mailchimp.com'을 (를) IP 번호로 확인할 수 없습니다. 호스트 이름이 유효하지 않거나 DNS에서 알지 못하거나 일부 바이러스 백신/방화벽 소프트웨어가 조회를 차단하고 있습니다. – robertklep
localhost에서 deployng하고 있지만 기능은 firebase –
에서 실행됩니다. 파이어베이스의 네트워크 연결? [이 블로그 게시물] (https://www.automationfuel.com/firebase-functions-sending-emails/)에서는 외부 API 요청을하기 위해 청구를 사용하도록 설정해야한다고 제안합니다. – robertklep