When creating a Swift executable that is using networking, (e.g to communicate with other AWS components, or any other internet resource), the host name cannot be found.
After looking a bit deeper, it turns out the issue is with some of the libraries copied from Ubuntu container used to compile Swift executable (i.e libcurl.so.4 and its dependents).
After manually removing libcurl.so.4, the executable started using /usr/lib64/libcurl.so.4 provided by the AWS Lambda OS, the host names were successfully resolved.
Hopefully this information will be useful for anyone trying to perform any network related actions inside Swift executables running on Lambda, and perhaps open a discussion whether copying all libraries provided by the ldd is sufficient / good enough.
When creating a Swift executable that is using networking, (e.g to communicate with other AWS components, or any other internet resource), the host name cannot be found.
After looking a bit deeper, it turns out the issue is with some of the libraries copied from Ubuntu container used to compile Swift executable (i.e
libcurl.so.4and its dependents).After manually removing
libcurl.so.4, the executable started using/usr/lib64/libcurl.so.4provided by the AWS Lambda OS, the host names were successfully resolved.Hopefully this information will be useful for anyone trying to perform any network related actions inside Swift executables running on Lambda, and perhaps open a discussion whether copying all libraries provided by the
lddis sufficient / good enough.