Skip to content

Connect-ExchangeOnline from AWS PowerShell lambda throws PSRemotingTransportException #849

Description

@geekganesh

I am trying to connect to exchange from AWS Powershell Lambda function. The script is working fine locally but throws below error when executed from AWS.

{
  "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()"
    ]
  }
}

Activity

  1. added
    bugThis issue is a bug.
    needs-triageThis issue or PR still needs to be triaged.
    on Apr 8, 2021
  2. ashishdhingra commented on Apr 8, 2021

    @ashishdhingra
    Contributor

    Hi @geekganesh,

    Good morning.

    Please refer the existing issues aws/aws-tools-for-powershell#203 and #332 for details about this error and possible resolution. This error is related to OpenSSL library. Let me know if these help.

    Thanks,
    Ashish

  3. added
    response-requestedWaiting on additional info and feedback. Will move to close soon in 7 days.
    on Apr 8, 2021
  4. geekganesh commented on Apr 12, 2021

    @geekganesh
    Author

    Hi @ashishdhingra

    I have created a AWS openssl layer to the lambda function. openssl support is available to lambda but i am getting the same error. Do i need to have my own container?

    Regards
    Ganesh

  5. removed
    response-requestedWaiting on additional info and feedback. Will move to close soon in 7 days.
    on Apr 13, 2021
  6. nickadam commented on Feb 4, 2022

    @nickadam

    PSWSMan rewrites shared object files when running Install-WSMan. I have not been able to get it to work with a zip. Since it takes ~1 min to connect to exchange online, I've decided to build a container image, https://github.com/nickadam/powershell-lambda, https://github.com/nickadam/exo-lambda. It's slow but it works.

  7. added
    p2This is a standard priority issue
    and removed on Nov 1, 2022
  8. added
    guidanceQuestion that needs advice or information.
    and removed
    bugThis issue is a bug.
    on Sep 9, 2024
  9. locked and limited conversation to collaborators on Sep 18, 2024
  10. converted this issue into a discussion #1811 on Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions