Upload error 500

What is the problem? Please be detailed.
Hi there.
While uploading a form for the first time from the mobile app, server returns 500 (ie. error).
When I upload it again, it returns 202 (ie. the form is submitted successfully).
In short, the first submission fails, the second doesn't and that's the pattern for all submissions.
We have run it locally and it works just fine.
Any idea where we are going wrong? Thanks.

What ODK tool and version are you using? And on what device and operating system version?
Our server is running on the AWS EC2 instance. Our app is built on top of the ODK collect v1.4.

What steps can we take to reproduce the problem?
You could download our app from play store

and try to submit a form? Also please make sure disable autosend. (If background send is running, then the issue doesn't exist, strangely)

What you have you tried to fix the problem?
We assumed it is probably an AWS thing, since it runs fine locally.

Anything else we should know or have? If you have a test form or screenshots or logs, attach here.

A 500 status code means your server is reaching an error state. Please look at your server logs. If you are running Aggregate you can post them here but if it's a custom server you will need to talk to your development team to find out how to address it.