I am sending my request to monday.com adding file I am getting a cors error for all other I’m using the mopnday js sdk and everything workds fine
async function uploadFile(file, ITEM_ID =“item_id”, COLUMN_ID = “files”) {
console.log(file, ITEM_ID, COLUMN_ID);
const query = mutation($file: File!) { add_file_to_column( file: $file, item_id: ${ITEM_ID}, column_id: "${COLUMN_ID}" ) { id } }
;
const formData = new FormData();
formData.append('query', query);
formData.append('variables'file]', file);
const response = await fetch('https://api.monday.com/v2/file', {
method: 'POST',
headers: {
'Authorization': env.key
},
body: formData
});
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.json();
}
Moreover when I copy the request to postman and send the same request from postman by copying it from my browser developer tools it works.
Update
Disabled cors in chrome using
open -n -a /Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome --args --user-data-dir="/tmp/chrome_dev_test" --disable-web-security
The same request now works Can you tell me how to work with cors in files api.
Is there a way to do it via the monday js sdk. Can onyone tell me