With the impeding deprecation on the AWS Lambda provided.al2, the replacement PowerShell runtime provided.al2023 has reduced from 109 MB to 40 MB. The libicu package is a casualty of this shrinkage and PowerShell Lambda functions need to be configured with the environment variable DOTNET_SYSTEM_GLOBALIZATION_INVARIANT set to 1.
Unfortunately, Lambda functions configured with provided.al2023 runtime are failing at the Import-Module -Name ImportExcel line specifically in the ImportExcel.psm1 file, where $culture is empty so the Import-LocalizedData -UICulture $culture -BindingVariable Strings -FileName Strings -ErrorAction Ignore causes the module to never load.
As a workaround, I commented out the following lines in ImportExcel.psm1 per
# $culture = $host.CurrentCulture.Name -replace '-\w*$', ''
# Import-LocalizedData -UICulture $culture -BindingVariable Strings -FileName Strings -ErrorAction Ignore
# if (-not $Strings) {
# Import-LocalizedData -UICulture "en" -BindingVariable Strings -FileName Strings -ErrorAction Ignore
# }
This had zero negative impact for my specific use-cases. I don't think it would be too hard to work around, as invariant just uses an empty string for $culture (I think) so branching around via if-else should be doable but I'm no expert.
With the impeding deprecation on the AWS Lambda provided.al2, the replacement PowerShell runtime provided.al2023 has reduced from 109 MB to 40 MB. The libicu package is a casualty of this shrinkage and PowerShell Lambda functions need to be configured with the environment variable DOTNET_SYSTEM_GLOBALIZATION_INVARIANT set to 1.
Unfortunately, Lambda functions configured with provided.al2023 runtime are failing at the Import-Module -Name ImportExcel line specifically in the ImportExcel.psm1 file, where $culture is empty so the Import-LocalizedData -UICulture $culture -BindingVariable Strings -FileName Strings -ErrorAction Ignore causes the module to never load.
As a workaround, I commented out the following lines in ImportExcel.psm1 per
# $culture = $host.CurrentCulture.Name -replace '-\w*$', ''
# Import-LocalizedData -UICulture $culture -BindingVariable Strings -FileName Strings -ErrorAction Ignore
# if (-not $Strings) {
# Import-LocalizedData -UICulture "en" -BindingVariable Strings -FileName Strings -ErrorAction Ignore
# }
This had zero negative impact for my specific use-cases. I don't think it would be too hard to work around, as invariant just uses an empty string for $culture (I think) so branching around via if-else should be doable but I'm no expert.