500 error on initial function call

Hi everyone,

We are building a forum that when submitted will send an email with an attachment.
The problem I’m having is that I have a pdf file that when attached to the forum causes the function to give a 500 error but this only happens the first time you submit the form, if you submit it again, everything works fine and the email is sent successfully with the attachment. The attachment is only 447KB and I’m converting it to a base64.
I tried with different attachments like word document which is 12 KB and I don’t seem to get the same issue.

Also, no logs are generated from this error.

Netlify site is: https://paymentshield-devhub.netlify.app

Hi there, @hhosseinipaymentshie :wave:

Sorry to hear you’re having difficulties here. There are a few other forums threads where members have experienced this. Perhaps this thread will offer some guidance.

If you read through that and are still having issues, please share your function name and the debugging steps you have taken. Thank you!

Hi @hillary and thank you for your response.

The thread which you sent me doesn’t seem to be connected to the issue I’m having. I get a 500 when my form is first submitted. This also doesn’t happen if the attachment sent with the form is small in size. I have a PDF that is 75KB and the form never fails to submit but if I choose another PDF file which is 447KB, I then get the error. Again, the error only occurs in the first submission. If the first submission fails, and you resubmit the form, you don’t get the error. When you get the 500 error, there is nothing in the response and also no logs are generated in the function log which makes it impossible for me to debug since I don’t get this issue locally.

My hands are tied behind my back here a little since I don’t know what I can do to debug it. Only you guys can help me now.

Hi @hhosseinipaymentshie

You might find this thread of interest which states

we’ve seen functions accept up to 6mb files.

Part of solving the issue is providing the x-nf-request-id for a failed call so Netlify can investigate.

Also, if you can share a repository (if not the one you are deploying, a minimal reproduction) this would also help.

Hi @coelmay @hillary

Thanks, for the response.

here is the repository. https://github.com/Paymentshield/developer-hub
x-nf-request-id: 01FTDJJ4FDDK5FMR71R4CTXJQ8

I don’t think that the file size is the issue but I do sometimes get 502 errors when at JSON.Parse(event.body). I don’t know again the reason why this only happens sometimes.

Hi, @hillary @hillary ,

Do you guys have any other suggestions I could use to maybe fix this issue?

Hey @hhosseinipaymentshie,

We’re seeing this happen with at least 2 more users. We’re already engaged in a discussion with the engineers on what the next steps should be, but the follow-up would most likely happen in the coming week.

Hi @hrishikesh,

Thank you for your response.

It’s good to hear that I’m not the only one facing this problem. Hopefully, this will be resolved soon.
Where will be the best place for me to keep an eye on updates about this issue?

hi there,

i took a look at the issue that was filed internally, and we have this thread mentioned here. It is a private issue, so you wouldn’t be able to subscribe to it, but you can subscribe to this thread, and when work is completed, we will post an update here.

2 Likes

Hi @perry,

Thanks for getting back to me. I’m glad the issue is being looked at. I’m the OP of this thread so I should be getting notified if anything new is posted here.

Thanks

1 Like