Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon web services AWS Lambda中的API超时?_Amazon Web Services_Aws Lambda_Serverless Framework - Fatal编程技术网

Amazon web services AWS Lambda中的API超时?

Amazon web services AWS Lambda中的API超时?,amazon-web-services,aws-lambda,serverless-framework,Amazon Web Services,Aws Lambda,Serverless Framework,我试图在AWS中创建一个lambda函数,该函数将创建一个新的条带标记: import stripePackage from 'stripe'; const stripe = stripePackage('...'); module.exports.create = (event, context, callback) => { stripe.tokens.create({ card: { "number": 4242424242424242,

我试图在AWS中创建一个lambda函数,该函数将创建一个新的条带标记:

import stripePackage from 'stripe';
const stripe = stripePackage('...');

module.exports.create = (event, context, callback) => {
    stripe.tokens.create({
      card: {
        "number": 4242424242424242,
        "exp_month": '02',
        "exp_year": '22',
        "cvc": '123'
      }
    }, (err, token) => {
      if (err) {
        console.log(err);
        callback(null, {
          statusCode: 400,
          body: "error"
        });
      }
      callback(null, {
        statusCode: 200,
        body: "ok"
      });
      console.log(token);
    });
}
但是,每次都会超时。我有一个用于出站连接的安全组,如下所示:

 Ports  Destination
 All    0.0.0.0/0

然而,我似乎唯一能连接到的是其他AWS服务。如何打开Lambda函数以连接AWS以外的连接?

如果Lambda函数不需要VPC资源访问,则需要从VPC中删除它,然后将其添加到VPC中只会带来性能问题,或者,您需要确保Lambda功能位于VPC的私有子网中,并且该子网具有到NAT网关的路由。

如果不需要访问VPC资源,则需要从VPC中删除Lambda功能,然后将其添加到VPC只会带来性能问题,或者,您需要确保Lambda功能位于VPC的私有子网中,并且该子网具有到NAT网关的路由