MediaManager upload() Error 413 or 504

Hello everyone,
I get data transferred to my Wix page via an html1_message from an integrated iFrame. This data contains an image as base64, which I want to upload to the Media Manager. Some time ago my code still worked, but now I get different error messages depending on the image. If I use a more complex image (image contains images, etc.), I get error 413. According to the documentation, the MediaManager allows 25 MB. However, the image only has 5 MB. If I try to upload a simpler image, I get the 504 error.
I have attached my method call and the method behind it. However, it seems that the method is no longer being called correctly. None of my console.log attempts within the function were output.

Page Code:

import { uploadImage } from 'backend/mediaManagerHandler'

export function html1_message(event) {
    let receivedData =;

    uploadImage(receivedData.draft, receivedData.draftname)
    .then((result) => {
        // do something
    .catch((err) => {
    // Add draft to cart
        // Product stuff
    // Update cart with new draft
    .then((updatedCart) => {
        // Products added to cart
        const cartId = updatedCart._id;
        const cartLineItems = updatedCart.lineItems;
        if (formFactor !== "Mobile") {
    .catch((error) => {


export async function uploadImage(buffer, name="unknown") {
    var image = buffer.replace("data:image/jpeg;base64,", "")
    var imageToUpload = Buffer.from(image, 'base64')
    const mediaOpt = {
        "mediaOptions": {
        "mimeType": "image/jpeg",
        "mediaType": "image"
        "metadataOptions": {
            "isPrivate": false,
            "isVisitorUpload": false
    const fileName =`${name}.jpeg`;
    const folderPath = "/path/to/folder";
    try {
        return await mediaManager.upload(folderPath, imageToUpload, fileName, mediaOpt);
    } catch (err) {
        console.error('Failed to upload image:', err);
        throw err;

If your code did always work, and now out of a sudden do not work anymore → well that sounds that wix has changed something. What could be the reason?

  1. Wix setted new limitations (maybe regarding the HTML-Component or other limits) ?
  2. Wix changed something in their code (code-structure)?

Here you should contact wix-customer-care to solve your problem.

Let us know the result! And how long it has taken.