JS error - Error evaluating code: ReferenceError: FormData is not defined

Hello, good morning!

I am attempting to successfully build a workflow and am running into the error in the title. I am not super familiar with JS and may be missing something. Can I get some assistance here please :grinning: I am trying to upload a csv to an Amazon S3 bucket via an api call by getting the pre-signed URL then uploading it via another api call written in JS

code and workflow below:

const array = [Object.keys(getOrgs.data[0])].concat(getOrgs.data)

const arraystring = array.map(it => {
return Object.values(it).toString()

const form = new FormData();
form.append('AWSAccessKeyId', getPreSignedURL.data.form_fields.AWSAccessKeyId);
form.append('key', getPreSignedURL.data.form_fields.key);
form.append('policy', getPreSignedURL.data.form_fields.policy);
form.append('signature', getPreSignedURL.data.form_fields.signature);
form.append('file', arraystring);

const options = {method: 'POST', headers: {accept: 'application/json'}};

options.body = form;

fetch(getPreSignedURL.data.url, options)
.then(response => console.log(response))
.catch(err => console.log(err));

Issue: When I run each tile manually, this flow works. When I schedule it or try to run the workflow, it gives me the above error

Hey @mmondragon!

At the moment, when running workflow blocks in the editor they're run within your browser meaning you have access to various web APIs (like FormData) that might not be available in the node environment that runs your workflow on the server.

Have you explored creating a REST query with a Form Data body type?

You can dynamically set the URL to be the pre-signed S3 URL whether using it as a regular block or a function block. What do you think?