简体   繁体   English

使用 aws sdk v3 调试 ENOTFOUND 错误

[英]Debugging ENOTFOUND error using aws sdk v3

I've been using AWS JS SDK V3 and have noticed that my lambdas are intermittently hitting errors connecting to AWS resources.我一直在使用 AWS JS SDK V3,并注意到我的 lambda 表达式间歇性地遇到连接到 AWS 资源的错误。 Below I have an example for dynamodb, but I have also had issues connecting to secrets manager.下面我有一个 dynamodb 的例子,但我在连接到 secrets manager 时也遇到了问题。 My lambdas and resources are all contained within a VPC.我的 lambda 和资源都包含在一个 VPC 中。 I've noticed that these issues seem to be hit more often during a lambda cold start, but I'm not entirely sure.我注意到这些问题似乎在 lambda 冷启动期间更频繁地出现,但我不完全确定。 If a request is resent (user on the frontend refreshes the page) this error seems to go away.如果重新发送请求(前端用户刷新页面),此错误似乎消失了 go。 I was hoping that the built in client retries would reduce the errors that my code sees, but it appears that no retries are attempted.我希望内置的客户端重试会减少我的代码看到的错误,但似乎没有尝试重试。

I am looking for potential debugging tips that might reveal what is the cause of these issues.我正在寻找可能揭示这些问题的原因的潜在调试技巧。 So far I've been looking through cloudwatch logs which does not appear to have any good insights.到目前为止,我一直在查看似乎没有任何好的见解的 cloudwatch 日志。 I believe this is being cause by bad DNS resolution, but I am surprised by the frequency of these errors.我相信这是由错误的 DNS 分辨率引起的,但我对这些错误的频率感到惊讶。 Stopping short of moving my lambdas to ec2 and utilizing a cache, what are ways in which I can fix this.除了将我的 lambda 表达式移至 ec2 并利用缓存之外,还有哪些方法可以解决此问题。

Reading this article: https://aws.amazon.com/premiumsupport/knowledge-center/vpc-find-cause-of-failed-dns-queries/ suggests increasing the DNS retry timer, but I'm unsure how I would do that as well.阅读这篇文章: https://aws.amazon.com/premiumsupport/knowledge-center/vpc-find-cause-of-failed-dns-queries/建议增加 DNS 重试计时器,但我不确定我会怎么做那也是。

{
    "errorType": "Error",
    "errorMessage": "getaddrinfo ENOTFOUND dynamodb.us-east-1.amazonaws.com",
    "code": "ENOTFOUND",
    "errno": -3008,
    "syscall": "getaddrinfo",
    "hostname": "dynamodb.us-east-1.amazonaws.com",
    "$metadata": {
        "attempts": 1,
        "totalRetryDelay": 0
    },
    "stack": [
        "Error: getaddrinfo ENOTFOUND dynamodb.us-east-1.amazonaws.com",
        "    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:71:26)"
    ]
}

How do you connect to DynamoDB from within your VPC?您如何从您的 VPC 连接到 DynamoDB?

Are you using a NAT instance or gatway?您使用的是 NAT 实例还是网关?

Are you using custom DNS resolution?您使用的是自定义 DNS 分辨率吗?

I would suggest that you add a DynamoDB VPCe to your VPC to allow you to connect to DynamoDB via AWS private.network.我建议您将 DynamoDB VPCe 添加到您的 VPC 以允许您通过 AWS private.network 连接到 DynamoDB。

暂无
暂无

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

相关问题 使用 AWS javascript SDK,V3,是否有等效的凭证提供程序链? - Using the AWS javascript SDK, V3, is there a credentials provider chain equivalent? AWS XRay 与 AWS SDK v3 for NodeJS - AWS XRay with AWS SDK v3 for NodeJS Aws SDK:集成 AWS v3 时出现 CredentialsProviderError Javascript SDK - Aws SDK: CredentialsProviderError while integrating AWS v3 Javascript SDK S3 为使用 aws-sdk v3 预签名的 PutObject 命令 url 提供 SignatureDoesNotMatch 错误 - S3 gives SignatureDoesNotMatch error for PutObject command pre-signed url using aws-sdk v3 BatchWriteItemCommand 与 AWS.DynamoDB class 在 Nodejs 中使用 AWS SDK V3 - BatchWriteItemCommand with AWS.DynamoDB class using AWS SDK V3 in Nodejs AWS SDK v3 for NodeJS 不调用 Lambda 也不返回错误 - AWS SDK v3 for NodeJS doesn't call Lambda nor returns error 如何使用预签名的 URL 以及 s3 aws-sdk-ruby v3 中的标签上传 object - How to upload an object using presigned URL along with tags in s3 aws-sdk-ruby v3 AWS SDK for JavaScript v3 PutObjectCommand error 'A header you provided implies functionality that is not implemented' - AWS SDK for JavaScript v3 PutObjectCommand error 'A header you provided implies functionality that is not implemented' 使用 AWS SDK V3 和 Typescript 查询具有多列的 Dynamo DB - Query Dynamo DB with multiple columns using AWS SDK V3 and Typescript 将 CognitoIdentityCredentials 迁移到模块化 AWS SDK for JavaScript (v3) - Migrating CognitoIdentityCredentials to modular AWS SDK for JavaScript (v3)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM