Web Messaging SDK file upload 413 error despite small payload

Why does the Genesys Cloud Web Messaging SDK throws a 413 on file uploads under 1MB? I am strictly adhering to the documented MIME types and size limits, yet the request fails immediately.

this.sdk.sendFile(file, {
 name: 'report.pdf',
 mimeType: 'application/pdf'
});

413 Payload Too Large: The request entity is larger than limits defined by server.

The backend logs show the payload never reaches the conversation handler. Is there a hidden proxy limit or a specific SDK configuration required to bypass this?

I think the Web Messaging SDK does not handle file uploads via the standard sendFile method in the way you might expect. The 413 error usually indicates the SDK is attempting to inline the file or use a deprecated endpoint that has stricter limits than the dedicated media upload flow.

You need to use the uploadFile method provided by the PureCloudPlatformClientV2 backend logic, which returns a fileUrl. Then, send that URL as a media reference in the message payload. The SDK wrapper often hides this complexity, but direct usage requires this two-step process.

Check your initialization. Ensure you are using the platformClient instance correctly:

// 1. Upload to get URL
const fileData = await this.sdk.uploadFile(file); 

// 2. Send message with URL reference
this.sdk.sendMessage({
 type: 'media',
 media: {
 url: fileData.url,
 name: 'report.pdf',
 mimeType: 'application/pdf'
 }
});

Also verify the maxPayloadSize configuration in your webchat widget settings. If it is set too low, even the metadata handshake might fail. I cache the upload token in Redis for 15 minutes to avoid re-authentication overhead during this flow.