AWS Lambda无法调用Facebook SDK

时间:2019-05-07 06:44:46

标签: node.js facebook facebook-graph-api aws-lambda facebook-javascript-sdk

我正在设置一个AMS lambda以便在内部调用facebook sdk,但不幸的是我无法从facebook SDK得到任何响应。

请找到以下代码:-

const listCampaign = async (event, context) => {
    context.callbackWaitsForEmptyEventLoop = false;
    await validateAuthToken(event.headers.Authorization, event.headers.accountId);
    console.log("account are",account)
    return  await account.getCampaigns([
        Campaign.Fields.account_id,
        Campaign.Fields.adlabels,
        Campaign.Fields.bid_strategy,
        Campaign.Fields.boosted_object_id,
        Campaign.Fields.brand_lift_studies,
        Campaign.Fields.budget_rebalance_flag,
        Campaign.Fields.budget_remaining,
        Campaign.Fields.buying_type,
        Campaign.Fields.can_create_brand_lift_study,

    ])
        .then((campaign) => {
            console.log("first check 3",campaign) // No response from facebook SDK and after 30 sec it get end point time out
})

1 个答案:

答案 0 :(得分:1)

最可能的原因可能是未为外部连接配置安全组。如果不是这种情况,并且lambda函数已部署在VPC中,请检查VPC子网是否具有NAt和Internet网关权限。