Large file upload failures and 502 errors
This article describes why large file uploads in AEM Forms may fail with a 502 error and provides steps to resolve these issues by adjusting file upload methods and reCAPTCHA settings.
Description description
Environment
- Adobe Experience Manager (AEM) Forms as a Cloud Service
Symptoms
- Submitting an Adaptive Form with large file attachments (typically 70 MB or larger) results in a 502 error.
- Error message indicates the string value length exceeds the maximum allowed by the platform.
- Failures occur when file attachments are sent as Base64-encoded data, causing the JSON payload to exceed the 20,000,000 character limit.
- If Google reCAPTCHA is enabled and the upload takes longer than 2 minutes, submissions fail due to token expiration.
Cause
- Sending large files as
Base64-encodeddata in the JSON payload exceeds the platform’s maximum string length. - reCAPTCHA tokens expire after 2 minutes, causing verification failures for long uploads.
Resolution resolution
To fix the 502 errors and submission failures, follow these steps:
-
Avoid sending large file attachments as Base64-encoded data in the form payload. Configure your Adaptive Form to upload files directly as binary attachments to a supported storage solution.
-
Ensure that the file upload component is set to use binary transfer rather than embedding files in the JSON payload. Refer to your integration documentation for configuring binary file uploads.
-
If you’re using Google reCAPTCHA, note that the token is valid for only 2 minutes. To prevent token expiration:
- Optimize the upload process so that file uploads complete within 2 minutes.
- If large or slow uploads are expected, disable reCAPTCHA for those forms, or consult your CAPTCHA team about extending the verification window (this is a Google-side limitation and not configurable in AEM).
-
Test form submissions with various file sizes and with reCAPTCHA enabled and disabled. Monitor submission duration and ensure it doesn’t exceed 2 minutes when reCAPTCHA is active.
-
After making these changes, verify that large file submissions complete successfully without 502 errors.