Skip to content

Running perl fails on AWS Lambda with NodeJS 20.x #135

@ultrakyo

Description

@ultrakyo

Prior to NodeJS 20.X, I was using NodeJS 16.x, and the following code worked fine with a layer from "arn:aws:lambda:${aws:region}:445285296882:layer:perl-5-32-runtime-al2:3".

async function readTagsAsync(localPath) {
return await new Promise((resolve, reject) => {
childProcess.exec(/opt/bin/perl ${exePath} -json -d '%Y-%m-%d %H:%M:%S' -fast ${localPath}, {
maxBuffer: 10 * 1024 * 1024, // Set maxBuffer to 10 MB
},
(err, stdout, stderr) => {
try {
if (err) {
reject(err);
return;
}
if (stderr) {
reject(stderr);
return;
}
resolve(JSON.parse(stdout));
} catch (e) {
reject(e);
}
});
});
}

When I change the runtime to NodeJS 20.x and layer to "arn:aws:lambda:${aws:region}:445285296882:layer:perl-5-38-runtime-al2023-x86_64:3", it fails to run perl with an error saying that "/bin/sh: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)\nperl: warning: Setting locale failed.\nperl: warning: Please check that your locale settings:\n\tLANGUAGE = "en_US.UTF-8",\n\tLC_ALL = "en_US.UTF-8",\n\tLC_CTYPE = "en_US.UTF-8",\n\tLC_MESSAGES = "C",\n\tLC_COLLATE = "C",\n\tLANG = "en_US.UTF-8"\n are supported and installed on your system.\nperl: warning: Falling back to the standard locale ("C").\n".

Can anyone help me solving this problem?

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