Skip to content

AWS Lambda runtime provided.al2023 and culture #1735

@kymcharlesworth-srg

Description

@kymcharlesworth-srg

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions