We are integrating file sharing into our custom agent desktop using the Web Messaging SDK. The requirement is to allow customers to upload support documents directly from the guest widget. I have configured the messaging deployment to allow file uploads and set the size limit to 10MB. The guest side is using the latest version of the genesys-cloud-messaging-sdk npm package.
The issue occurs when a customer tries to upload a PDF file. The file size is small, only about 200KB. The MIME type is correctly identified as application/pdf. However, the upload fails immediately with a 415 Unsupported Media Type error. The error response body is empty, which makes debugging difficult.
Here is the configuration object we are passing to the SDK initialization:
const config = {
orgId: 'our-org-id',
deploymentId: 'messaging-deployment-id',
fileUpload: {
enabled: true,
allowedMimeTypes: ['application/pdf', 'image/png', 'image/jpeg'],
maxSize: 10 * 1024 * 1024 // 10MB
}
};
I have verified the MIME type on the client side before the upload attempt. The File object passed to the SDK has the correct type. The network tab shows the request going to the Genesys Cloud file upload endpoint. The request headers include the correct authorization token. The content type of the request is multipart/form-data.
I tried adding image/gif to the allowed list just to test if it was a specific issue with PDFs. The error persists for all file types. It seems like the server is rejecting the content type regardless of what is in the allowedMimeTypes array.
Is there a specific header required for the file upload request? Or is there a limitation with the guest API for file uploads that is not documented? I have checked the deployment settings in the admin portal multiple times. Everything looks correct there. The web messaging deployment is active and linked to the correct routing queue.
Any ideas on what could be causing this 415 error? I have been stuck on this for two days. I am starting to think it might be an issue with how the SDK constructs the multipart request. But the SDK is a black box in this regard. I cannot easily inspect the raw HTTP request before it is sent.
If anyone has successfully implemented file uploads in a custom desktop, please share your configuration. I need to know if I am missing a step in the setup. The documentation says to just enable it in the deployment and configure the SDK. It does not mention any backend changes. But the error suggests the server does not recognize the media type.
I will try to capture the full request payload using a proxy tool to see if the MIME type is being sent correctly. But until then, I am at a loss. The error message is not helpful. I need a way to see what the server expects. Is there a way to enable verbose logging for the file upload process? I have set the log level to debug but nothing useful appears in the console. The SDK logs show the upload starting and then the error. No details about the request body or headers.
I am also wondering if the issue is related to the OAuth token scope. I am using a token with the webchat:read and webchat:write scopes. Is there a specific scope required for file uploads? I could not find any mention of file-related scopes in the documentation. The token is valid and works for sending text messages. So authentication is not the problem. The problem is specifically with the file upload request.
I will continue to investigate. But any help is appreciated. I am running out of options. I have tried clearing the cache, using a different browser, and recreating the deployment. Nothing changes. The error is consistent. It happens every time a file is selected. Even for text files. I added text/plain to the allowed types just to test. Same error.
This suggests the issue is not with the MIME type validation on the server. It might be something else. Maybe the request format is wrong. Or the endpoint is incorrect. But I am using the SDK to handle the upload. I am not making direct API calls. So the SDK should be handling the details. Unless there is a bug in the SDK. That is a possibility. I will check the GitHub issues for the SDK repository. Maybe someone else has reported this.
For now, I am stuck. I need to resolve this quickly. The client is asking for an update. I cannot explain that the file upload feature is broken. It is a critical feature for our use case. Customers need to send screenshots and documents. Without file uploads, the desktop is not very useful. I hope I can find a solution soon. I will post an update if I find anything. But I am hopeful someone here has seen this before. It feels like a common issue. But I could not find any answers online. The forums are quiet on this topic. Maybe no one else is using file uploads. Or maybe they are not having issues. I am not sure. I just need to fix this. Please help.