Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhandled Exception when used in AWS Lambda Environment #13

Open
RufusJWB opened this issue Oct 4, 2017 · 6 comments
Open

Unhandled Exception when used in AWS Lambda Environment #13

RufusJWB opened this issue Oct 4, 2017 · 6 comments

Comments

@RufusJWB
Copy link
Contributor

RufusJWB commented Oct 4, 2017

Just to let you know: When your library is embedded into a program that is executed in an AWS Lambda environment, it throws an Unhandled Exception: System.IO.FileNotFoundException: Could not find file '/sys/class/net/lo/mtu'.

After some research it turned out, the problem is in the method NetworkInterface.GetAllNetworkInterfaces(); which seems to be not always working under Linux. I opened a stackoverflow thread: https://stackoverflow.com/questions/46567897/how-to-prevent-filenotfoundexception-in-getallnetworkinterfaces-when-called-in

@MichaCo
Copy link
Owner

MichaCo commented Oct 4, 2017

That's a bug in dotnet core which should be fixed in .net core 2.0... Just have to find time to target netstandard2.0 for this lib one day...

@RufusJWB
Copy link
Contributor Author

RufusJWB commented Oct 5, 2017

@MichaCo
Copy link
Owner

MichaCo commented May 28, 2018

The next version will have a netstandard2.0 target, Maybe those things will be fixed.
Anyways, even if it is not fixed, you'll have to work around by determine the DNS endpoints manually with code which works on the platform you are running it on.
This library cannot close all those gaps ;)
But let me know how it goes anyways

@MichaCo MichaCo closed this as completed May 28, 2018
@sudsy
Copy link

sudsy commented Jul 31, 2018

I can confirm that this is still a problem in lambda even after upgrading to dotnetcore 2.1.0

@MichaCo
Copy link
Owner

MichaCo commented Jul 31, 2018

ok, that's unfortunate. I'll reopen the issue for tracking. Not sure if I can do anything to fix it though...

DnsClient should work though when you don't use "autodiscovery" of DNS servers and pass in one or more, right?

@sudsy
Copy link

sudsy commented Jul 31, 2018

Yes, It works without autodiscovery.

My workaround for anyone else experiencing this issue is to use a bash command to get the name server to query.

var nameServer = $"cat /etc/resolv.conf |grep -i '^nameserver'|head -n1|cut -d ' ' -f2".Bash().Trim();

Using a bash ShellHelper I found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants