Webhook API Integration not working with base64 encoded files

Hi there, I have a javascript API integration to post form data to my backend webhook, including uploaded files. I’ve implemented the javascript to base64 encode the contents of the files when present and that part is working. The webhook also works, EXCEPT when there are files. It simply never comes through and there are no errors logged to the console or anything. Is there a max payload size that I’m exceeding or something? Code below:

// Javascript rule code
function readAsDataUri(file) {
  return new Promise((resolve, reject) => {
    const reader = new FileReader();
    reader.addEventListener('loadend', (e) => {
      if (typeof reader.result === 'string') {
        resolve(reader.result);
      } else {
        reject(reader.error);
      }
    });
    reader.readAsDataURL(file);
  });
}

const API_URL = `https://<my_domain_here>/api/application/`;

let fields = {};

for (const [key, value] of Object.entries(feathery.fields)) {
  fields[key] = feathery.fields[key].value;
}

const urlParams = new URLSearchParams(window.location.search);
const formId = urlParams.get('_slug');

let uploads = fields.uploads;
let uploadsResolved = [];

console.log('uploads', uploads);

if (uploads && uploads.length) {
  console.log('uploads.length', uploads.length);
  uploads = await Promise.all(uploads);
  
  let contents = [];
  uploads.forEach(f => contents.push(readAsDataUri(f)) );
  contents = await Promise.all(contents);

  contents.forEach((val, idx) => {
    uploadsResolved.push({
      name: uploads[idx].name,
      size: uploads[idx].size,
      type: uploads[idx].type,
      contents: contents[idx]
    });
  })
}

fields.uploads = uploadsResolved;
console.log('fields.uploads', fields.uploads);


const payload = {
  formId: formId,
  fields: fields,
  userId: feathery.userId,
  stepProperties: feathery.getStepProperties(),
  completed: feathery.isLastStep(),
  isTestForm: feathery.isTestForm()
}

console.log('payload', payload);

feathery.http.post(API_URL, payload);

Hello. For API calls with files, a multipart/form-data request would work the best.

Totally, that’s a fair point, but essentially what I’m wanting to know is if it’s possible to have feathery post the files to my endpoint using the feathery.http built-in. I’m including an auth header in my webhook to verify the sender, so I’m hoping there’s a way to do so server-side as to not leak this credential on the client. If you can provide a code example if this is possible that would be much appreciated. Thanks so much!

Here’s some Feathery references on API calls: