简体   繁体   English

AWS Lambda 中的 python 请求超时

[英]python requests in AWS Lambda Timeout

When trying to use requests in my function, it only timeout without additional error.当尝试在我的 function 中使用请求时,它只会超时而不会出现其他错误。 I was trying to use rapidapi for amazon.我试图在亚马逊上使用 rapidapi。 I already have the host and key, but when I test my function it always timeout.我已经有了主机和密钥,但是当我测试我的 function 时,它总是超时。 My zip file and my function were on the same directory and I knew that my code was correct.我的 zip 文件和我的 function 位于同一目录中,我知道我的代码是正确的。

I just figured out that my VPC configuration in Lambda was can only access within the resources of the VPC.我刚刚发现我在 Lambda 中的 VPC 配置只能在 VPC 的资源内访问。 I just removed the VPC and it now runs.我刚刚删除了 VPC,它现在可以运行了。 But when your lambda function will connect to your database, you need to add and configure your VPC.但是当您的 lambda function 将连接到您的数据库时,您需要添加和配置您的 VPC。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM