Hi @Ryan ,
I’m trying to figure out a solution for this in an aws lambda image (public.ecr.aws/lambda/nodejs:20.2023.12.13.20-arm64), the command you shared here doesn’t solve the pdfnet error for me.
What specifically is PDFWorker looking for from the locale settings?
More specifically looking at locale there seems to be a key file (/etc/locale.conf ?) missing in the aws/lambda/nodejs:20 image that is preset in the nodejs:14 image, where my pdftron function code executes without the locale error:
# public.ecr.aws/lambda/nodejs:14.2024.03.28.15-arm64
sh-4.2# uname -m
aarch64
sh-4.2# node -v
v14.21.3
sh-4.2# locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
sh-4.2#
# public.ecr.aws/lambda/nodejs:20-arm64
sh-5.2# uname -m
aarch64
sh-5.2# node -v
v20.11.1
sh-5.2# locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
sh-5.2#
I found my missing package; for the AWS provided Lambda images for nodejs, the required package for the PDFTron addon is glibc-langpack-en . I think this is specifically for operations using the Convert class.
I am having the same issue on AWS Lambda when doing anything later than node18 node 20 and node 22 all give that same locale. Of course we are not creating the amazon linux run time environment - I thought it was our original packaging of library in a layer but now that I’ve tried to remove layer and package the node modules as all other lambdas I get the same error as above.
I can build in drone on aws using an amazon image :20 and :22 which is node 20 and node 22 ) but as long as I specify that this lambda is node18.x and of course architecture x86_64 (amd64 really)
Then everything works.
Has anyone seen any workarounds I am using serverless framework 4 to deploy etc. it was there using version 3 - so its not dependent on that framework…
could it be webpack or anything…