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

Connecting to ExchangeOnline through Lambda PowerShell fails with: "Unable to load shared library 'libpsrpclient' or one of its dependencies... #203

Closed
1 task
andybirenzi opened this issue Mar 8, 2021 · 4 comments
Labels
bug This issue is a bug. closed-for-staleness module/powershell-cmdlets response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@andybirenzi
Copy link

Description

I'm have following script in my pwsh lambda function:

Reproduction Steps

$creds = New-Object System.Management.Automation.PSCredential -ArgumentList $username, $secureStringPwd

Connect to Exchange Online

Connect-ExchangeOnline -Credential $creds

Logs

"errorType": "PSRemotingTransportException",
"errorMessage": "This parameter set requires WSMan, and no supported WSMan client library was found. WSMan is either not installed or unavailable for this system.",
"stackTrace": [
"at Amazon.Lambda.PowerShellHost.PowerShellFunctionHost.ExecuteFunction(Stream inputStream, ILambdaContext context)",
"at lambda_method(Closure , Stream , Stream , LambdaContextInternal )"
],
"cause": {
"errorType": "DllNotFoundException",
"errorMessage": "Unable to load shared library 'libpsrpclient' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibpsrpclient: cannot open shared object file: No such file or directory",
"stackTrace": [
"at System.Management.Automation.Remoting.Client.WSManNativeApi.WSManInitialize(Int32 flags, IntPtr& wsManAPIHandle)",
"at System.Management.Automation.Remoting.Client.WSManClientSessionTransportManager.WSManAPIDataCommon..ctor()"
]
}

Environment

  • Build Version:
  • OS Info:
  • Build Environment:
  • Targeted .NET Platform:
    Name Value

PSVersion 7.1.2
PSEdition Core
GitCommitId 7.1.2
OS Darwin 18.7.0 Darwin Kernel Version 18.7.0: Thu Jun 20 18:42:21 PDT 2019; root:xnu-4903.270.47~4/RELEASE_…
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

Resolution

  • 👋 I can/would-like-to implement a fix for this problem myself

I just need PowerShell to connect to ExchangeOnline through ModenAuth


This is a 🐛 bug-report

@andybirenzi andybirenzi added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Mar 8, 2021
@ashishdhingra
Copy link
Contributor

Hi @andybirenzi,

Looks like there was a similar issue aws/aws-lambda-dotnet#332 opened long time back. As suggested in that issue, please refer the forum article https://forums.aws.amazon.com/thread.jspa?messageID=918094 for possible solution. Kindly note that Lambda works on minimal RHEL image. Let me know if it works for you.

Thanks,
Ashish

@ashishdhingra ashishdhingra added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed needs-triage This issue or PR still needs to be triaged. labels Mar 8, 2021
@andybirenzi
Copy link
Author

The suggestion solution didn't work for me, I'm not able to find missing dependencies. I'm on MacOS.

The missing deps are:
libcrypto.so.1.0.0
libssl.so.1.0.0

I copied them from /opt/microsoft/powershell/6/ to ~/.nuget/packages/microsoft.powershell.native/6.1.0/runtimes/linux-x64/native. Republished and everything worked.

Please suggest if you get it working on Mac

@ashishdhingra
Copy link
Contributor

The suggestion solution didn't work for me, I'm not able to find missing dependencies. I'm on MacOS.

The missing deps are:
libcrypto.so.1.0.0
libssl.so.1.0.0

I copied them from /opt/microsoft/powershell/6/ to ~/.nuget/packages/microsoft.powershell.native/6.1.0/runtimes/linux-x64/native. Republished and everything worked.

Please suggest if you get it working on Mac

@andybirenzi Looks like these dependencies are related to Open SSL. Article https://gist.github.com/aklap/e885721ef15c8668ed0a1dd64d2ea1a7 might be helpful. I do see this as a PowerShell specific issue also documented on PowerShell/PowerShell#5561.

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Mar 9, 2021
@ashishdhingra ashishdhingra added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Mar 9, 2021
@github-actions
Copy link

This issue has not recieved a response in 2 weeks. If you want to keep this issue open, please just leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added the closing-soon This issue will automatically close in 4 days unless further comments are made. label Mar 23, 2021
@github-actions github-actions bot added closed-for-staleness and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Mar 31, 2021
aws-sdk-dotnet-automation pushed a commit that referenced this issue Jun 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. closed-for-staleness module/powershell-cmdlets response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

No branches or pull requests

2 participants