Unable to access MySql.Data.ddl in powershell Lambda, cannot add dependencies to powershell lambda deployment

0

I have been having issues adding a MySql.Data.dll to the deployment package of my powershell lambda functions. I have manually copied the dll to the AWSPowershell.NetCore directory and it appears in the modules folder of the deployed lambda function. However, I cannot find a way to get the dll into the base location of the lambda function's deployment package nor a way to access it if it's in the modules folder.

Lambda structure:

lamda-function.ps1 <-  import  <- layer.ps1(Layer)

The dll resides in the modules folder of lambda-function's deployment package and layer.ps1 is attempting to invoke the command causing the issue.

Line causing the error:

[void][System.Reflection.Assembly]::LoadWithPartialName("MySql.Data");

Error received:

- [Information] - Error Message:  Exception calling "LoadWithPartialName" 
with "1" argument(s): "Could not load file or assembly 'MySql.Data.dll, 
Culture=neutral, PublicKeyToken=null'. Operation is not supported. (Exception 
from HRESULT: 0x80131515)"
- [Information] - Error in Line:[void] 
[System.Reflection.Assembly]::LoadWithPartialName("MySql.Data.dll");

Areas where my MySql.Data.dll file has been added:

- C:\path\Documents\PowerShell\Modules\AWSPowerShell.NetCore\3.3.335.0
- C:\Program Files\PowerShell\6

Information regarding my environment:

  • Deployed using Powershell 6 from my local machine.
  • Using runtime .NET Core 2.1 (C#/PowerShell)
powershell
aws-lambda
asked on Stack Overflow Dec 10, 2020 by devinogle • edited Dec 11, 2020 by devinogle

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0