Mobile API offline sync fails to upload attachments after re

Our field agents use Pega Mobile 8.7 to capture inspection reports with photos while offline. When they reconnect and sync, the case data uploads successfully but attachments consistently fail. The mobile app shows “Sync Failed” for any case with attachments larger than about 5MB.

Error from mobile logs:


Attachment upload failed: IMG_20241118_092341.jpg (8.2 MB)
Error: Request timeout after 30000ms

The offline sync logic doesn’t seem to handle large files properly, and we haven’t configured any attachment size limits in the mobile app settings. Field agents are losing critical inspection photos, and we’re having to ask them to re-upload manually through the web portal. Is there a way to implement chunked upload for mobile attachments or adjust the sync timeout configuration?

Is there documentation on implementing chunked uploads in Pega Mobile? And what about the attachment size limits - should we be compressing images on the mobile device before upload? Our inspection photos are often 10-15MB straight from the camera.

We had similar issues last year. The default mobile sync timeout is way too short for large attachments, especially on slower cellular connections. Check your mobile app’s network settings - there should be a timeout configuration you can increase. Also, are your field agents using Wi-Fi or cellular when syncing? 8MB photos over 3G/4G can easily exceed 30 seconds.

Here’s a comprehensive solution addressing all three aspects of your mobile attachment sync issues:

1. Offline Sync Logic Enhancement: Your current sync implementation treats attachments as atomic uploads, which fails for large files. Modify your offline sync workflow to handle attachments differently from case data:

  • Separate Sync Queues: Maintain separate queues for case data and attachments in the mobile app’s local storage
  • Priority Sync: Upload case data first (fast), then process attachments sequentially
  • Resume Capability: Track upload progress locally so interrupted uploads can resume from the last successful chunk
  • Retry Logic: Implement exponential backoff for failed attachment uploads (retry after 30s, 60s, 120s)

In your mobile app configuration (MobileChannel rule), enable advanced sync options:

  • Set SyncStrategy to “Differential” for attachments
  • Enable background sync so uploads continue even if the app is minimized
  • Configure sync status notifications so agents know when uploads complete

2. Attachment Size Limits & Compression: Implement a multi-tier approach to handle various file sizes:

Client-Side Optimization: Configure image compression in your mobile app’s media capture settings. Add this to your mobile channel configuration:


ImageQuality: 85
MaxResolution: 2560x1920
Format: JPEG

This reduces typical 12MB photos to 3-4MB while maintaining inspection-quality resolution.

Size-Based Upload Strategy:

  • Files < 5MB: Standard single-request upload (current method)
  • Files 5-15MB: Chunked upload with 2MB chunks
  • Files > 15MB: Prompt user to compress or warn about long upload time

Set explicit size limits in your attachment service rule:

  • Maximum single file: 50MB (server-side enforcement)
  • Maximum total attachments per case: 200MB
  • Return clear error messages when limits exceeded

3. Chunked Upload Implementation: Implement chunked upload support for large files:

Mobile App Side: Modify your attachment upload activity to detect file size and choose upload method:

if (fileSize > 5MB) {
  uploadChunked(file, chunkSize: 2MB);
} else {
  uploadStandard(file);
}

Server-Side API Configuration: Create a new REST service endpoint for chunked uploads: `/api/v1/attachments/chunked Service implementation:

  • Accept multipart/form-data with chunk metadata (chunk number, total chunks, file ID)
  • Store chunks temporarily in a staging area
  • When final chunk received, reassemble file and attach to case
  • Return chunk confirmation after each successful upload

Data Transform for Chunk Processing:


Set .ChunkNumber = Primary.ChunkNumber
Set .TotalChunks = Primary.TotalChunks
Set .FileID = Primary.FileID
Set .ChunkData = Primary.ChunkData

Validate chunk sequence and reassemble when complete.

Timeout Configuration: Increase timeout settings for attachment uploads:

  • Mobile app network timeout: 120 seconds (allows 2MB chunk upload on slower connections)
  • Server-side timeout: 180 seconds
  • Keep-alive interval: 30 seconds to prevent connection drops

Configure these in your mobile app’s network profile and corresponding REST service.

Implementation Steps:

  1. Update mobile channel to enable image compression (immediate improvement)
  2. Increase sync timeout to 120s in mobile network settings
  3. Implement chunked upload REST service for files > 5MB
  4. Update mobile app’s attachment upload logic to use chunked method
  5. Add sync status tracking and resume capability
  6. Test with various file sizes and network conditions

Expected Results:

  • Files < 5MB: Upload in 5-15 seconds on 4G
  • Files 5-15MB: Upload in 30-90 seconds via chunked method
  • Failed uploads automatically retry without user intervention
  • Agents see clear progress indicators during sync

This solution eliminates attachment sync failures while maintaining photo quality for compliance requirements. The chunked upload approach is especially critical for field agents on unreliable cellular networks.

Compression helps but isn’t a complete solution if you need full-resolution photos for compliance. For chunked uploads, you need to customize the attachment upload flow. The mobile SDK has a FileUploadService that supports chunked mode, but it’s not enabled by default. You’ll need to modify your REST service to handle the multipart/form-data content type and implement server-side chunk reassembly logic.

The 30-second timeout is actually a mobile platform limitation, not just a configuration issue. For large files, you need to implement chunked uploads. Pega 8.7 mobile SDK supports this, but it requires custom configuration. You’ll need to modify your attachment upload service to accept multipart uploads, where the mobile app splits large files into smaller chunks (typically 1-2MB each) and uploads them sequentially. Each chunk gets reassembled on the server side.