Open sema4-daniilvolkov opened 3 years ago
Thanks for letting us know. It does look related to https://github.com/corretto/corretto-11/issues/118, we're pulling in the right people from AWS Lambda to help on the issue.
@davecurrie thanks for looking at this. Do you have any estimates of when it will be resolved? Due to https://aws.amazon.com/blogs/compute/announcing-migration-of-the-java-8-runtime-in-aws-lambda-to-amazon-corretto/ we need to resolve it till July 19, 2021.
July 19, 2021: Any new functions using the java8 runtime will use Amazon Corretto. If you update an existing function, it will transition to Amazon Corretto automatically.
In the opposite way maybe do you have some workarounds in mind that can help us to resolve it?
Thanks for understanding!
@davecurrie after small research was tried the next:
So, looks like AWS Lambda uses Java Corretto Alpine version that leads to the issue. Hope this information will be helpful for resolving the issue on your side.
P.S: The same case for Java 11 as well.
Hi @sema4-daniilvolkov, thank you for the follow-up research.
For Corretto 8 on Alpine (amazoncorretto:8-alpine-jdk
), can you verify if you have installed fontconfig
? It isn't shipped by default in amazoncorretto:8-alpine-jdk
, but it's required in order to locate a custom font.
Here's my reproduction steps within amazoncorretto:8-alpine-jdk
:
apk add ttf-freefont
(This also installs fontconfig as dependency.)
import java.awt.Font;
import java.awt.FontFormatException;
import java.io.IOException;
import java.util.Objects;
public class GitHub317 { public static void main(String[] args) throws IOException, FontFormatException { String fName = "/usr/share/fonts/TTF/FreeSerif.ttf"; Font customFont = Font.createFont(Font.TRUETYPE_FONT, Objects.requireNonNull(GitHub317.class.getResourceAsStream(fName))); Objects.requireNonNull(customFont); } }
I didn't see any issue when running the test above.
I've added fontconfig.zip as a Lambda Layer and it started working!
The issue is potentially related to https://github.com/corretto/corretto-11/issues/118
the ttf is present in the resources folder
and during invoking the lambda function got the next exception message:
this issue is related to Java8 Corretto and Java11 Corretto
with Java8 (OpenJDK) - works without any problems Due to https://aws.amazon.com/blogs/compute/announcing-migration-of-the-java-8-runtime-in-aws-lambda-to-amazon-corretto/ we have to make it work on Corretto.