Closed 0xdeadbeefJERKY closed 7 months ago
Ahh, interesting. We previously used requests
, but then switched to urllib to remove the dependency. Maybe we should switch again to urllib3
.
Thanks for the bug report.
@0xdeadbeefJERKY - Would you be up for testing out the proposed fix in #88 ? You just need to use the patched version and set the variable, e.g.
module "alternat_instances" {
source = "git::https://github.com/1debit/alternat.git//modules/terraform-aws-alternat?ref=patch-getaddrinfo"
lambda_has_ipv6 = false
...
}
@0xdeadbeefJERKY Can you share a little more about your configuration so I can understand the conditions under which this is happening?
CHECK_URLS
?The reason I'm asking is that VPCs do not have IPV6 enabled by default, so folks have to enable it if they want it, and most do not. I think most Alternat users are not using IPV6 VPCs, and yet this is the first time this error has been reported. Would be nice to reproduce it.
If you have already applied this, please do so again. There was a bug in the previous version and I've fixed it.
@bwhaley We're test driving the alternat deployment in us-west-2 and set CHECK_URLS
to ["https://www.google.com]
. I reviewed our configurations for the VPC, private subnet, route tables, and even Route 53 out of an abundance of caution, but didn't find anything that would suggest our environment is contributing to the issue. My hunch is that the Python 3.8 Lambda runtime supports dual-stack by default, but this is never reconciled with the VPC/private subnet configuration (or a relevant bug exists in the runtime that isn't publicly documented).
@bwhaley We've been running alternat with the fix for a few days now and everything's working as expected 🎉 . Thanks so much!
Occasionally,
urllib
will resolve the provided check URL to an IPv6 address. If the VPC in which the Lambda function is running isn't configured to support IPv6, the Lambda function will throw the following error:Some simple Googling reveals that this is often attributed to the host not supporting IPv6 (example). Unfortunately, I haven't been able to find a trivial way to force the built-in
urllib
package to use IPv4-only resolution. One alternative would be to addrequests
orurllib3
as a dependency (and Lambda layer), and use the following to accomplish this: