Why is this Javascript not working?

I am a Javascript noob really. Got this code from Stackoverflow, but it does not work when implementing it in a nocode app (which gives you the option to use javascript).

The goal:
upload a file that an user uploads to a Google Drive environment.

The code that is not working:
good to know: certain variables, such as file, filename etc, are basically uploaded by the user. AppGyver then fills in these variables (so they are dynamic).
Here goes:
const {
} = inputs;

let file = file

var metadata = {
name: filename,
mimeType: mimetype,
parents: [‘folderid’], // Please set folderId here.
var form = new FormData();
form.append(‘metadata’, new Blob([JSON.stringify(metadata)], {type: ‘application/json’}));
form.append(‘file’, file);
fetch(‘https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart’, {
method: ‘POST’,
headers: new Headers({‘Authorization’: 'Bearer ’ + token}),
body: form
}).then((res) => {
return res.json();
}).then(function(val) {