Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Kotlin version of application in AWS Apprunner is failing with MultipartException #2

Open
mateuszbyczkowski opened this issue Jul 5, 2024 · 4 comments

Comments

@mateuszbyczkowski
Copy link

First of all, thank you for your work. You have provided a nice wrapper on libreoffice.

Here is the issue:
I deployed newest version (2.1.0-12 and 2.1.0-11) of docker image from https://hub.docker.com/r/moalhaddar/docx-to-pdf to AWS Apprunner and I received

2024-07-05T13:33:07.410Z ERROR 1 --- [nio-8080-exec-8] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed: 
org.springframework.web.multipart.MultipartException: Failed to parse multipart servlet request] with root cause
java.net.SocketTimeoutException: null
at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.fillReadBuffer(NioEndpoint.java:1267) ~[tomcat-embed-core-10.1.13.jar!/:na] ...

I tried again with the same payload (same request, same image) locally and it was working fine.

My command (I tried with multiple files between 58kb and 4mb) :

curl --location 'https://xyz-west-1.awsapprunner.com/pdf' \
--form 'document=@"/xyz/template1_output.docx"'

I tried once again but with older version of your image (2.1.0) and this time it was working both locally and on AWS.

I have no idea what could cause this issue, but I see that both versions 2.1.0-12 and 2.1.0 are in Java.
Could you provide an information what are the commits between 2.1.0 and 2.1.0-11? I might find the issue and provide you a PR.

Best regards

@moalhaddar
Copy link
Owner

Thanks for reporting!

Regarding the versions, the dash part that comes after the version number is the build number, that was introduced after creating the pipeline here: 2a81f75

Run #12 is the latest run , hence the latest version is: 2.1.0-12 and the commit of that is (and should be) always the master branch.

Before that, the images were being pushed manually (the 2.1.0 one was pushed manually).

A mistake from my part was not including metadata with the images about their respective commit hash.

Regardless, both 2.1.0 and 2.1.0-12 are nearly similar.

From the error message that i see, i could see that the root cause is SocketTimeoutException, are you sure that the connectivity to the 2.1.0-12 was fine?

You can manually that by calling the actuator health endpoints:

$ curl localhost:8080/actuator/health
{"status":"UP","groups":["liveness","readiness"]}

Let me know if that works so we can further narrow down the issue

@duronxx
Copy link

duronxx commented Jul 10, 2024

image
The server receives normally, but when submitting tasks, it results in garbled text. The file contains Chinese characters and images. Is this supported?
image

@moalhaddar
Copy link
Owner

moalhaddar commented Jul 12, 2024

@duronxx for the fonts you may want to include the fonts used in the doucment manually in a seperate volume

see this command:

docker run \
 --rm --name docx-to-pdf \
 -p 8080:8080  \
 -e "pool.size=1" \
 -v ./fonts:/usr/share/fonts/custom \ <----------------------- Notice this volume
  moalhaddar/docx-to-pdf:latest

If the results above are from a the curl, you may want to save the output first to a pdf file

curl --output file.pdf \
--location 'http://localhost:8080/pdf' \
--form 'document=@"/input.docx"'

@aandrader
Copy link

Im facing the same issue.

2024-07-16T17:23:46.243Z ERROR 1 --- [nio-8080-exec-3] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed: org.springframework.web.multipart.MultipartException: Failed to parse multipart servlet request] with root cause

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants