Open andreapiso opened 6 months ago
I'm experiencing the same issue. The code is very similar as well. The PDF files for testing in my case are very small, but either take a long time to send to my API or hang. I tried sending the file after converting to base64, which worked almost instantaneous.
@andreapiso Can you share a minimal repo?
@karimfromjordan here is a minimal repo: https://github.com/andreapiso/minimal-pdf-post
I discovered that the bug is linked to the node version. The repo above hangs on node 20.4.0 but works on node 21.7.0 and 18.16.1
Probably related: #11126
I was having a similar issue, it got resolved after I add enctype="multipart/form-data"
to the form element : <form enctype="multipart/form-data" action="?/upload" method="post" ></form>
@tichmajena probably not the same issue - this one only got solved by updating the node version - there's reason to believe there are still combinations of sveltekit and node which have a broken POST.
Describe the bug
Somehow, suddenly I am not able to send PDF files via POST to external APIs when running on localhost.
However, if I deploy this code on Vercel, it works fine - it only hangs on localhost. What could be going wrong here?
Reproduction
I have set up something simple to replicate:
I have a simple file upload button:
Which posts the PDF to an endpoint /api/one
This endpoint simply takes the FormData and re-posts it to another endpoint (just to replicate the issue)
The second endpoint hangs on
event.request.formData()
.POSTing to other external endpoints like Python FastAPI causes the same issue.
Logs
No response
System Info
Severity
blocking all usage of SvelteKit
Additional Information
No response