Skip to main content

Hello!


My app, which has been running for a few years, suddenly stopped uploading files. It seems that the upload via the v2/ endpoint stopped working. I have a client-side JavaScript app using fetch. It is a known example from this forum.


let query = `mutation add_file($file: File!) {
add_file_to_column (item_id: ${itemId}, column_id: "${columnId}", file: $file) {id}
}`;

const formData = new FormData();
formData.append("variables[file]", newFile, newFile.name);
formData.append("query", query);

let result = await fetch('https://api.monday.com/v2/', {
method: "POST",
body: formData,
headers: {
"Authorization": "APIToken"
}
});

I tried a few things that failed:




  1. v2 endpoint: Monday returns CORS error “error type: cors, status: 500”.




  2. v2/file endpoint: I got an error, but not from Monday, “Failed to fetch” and “has been blocked by CORS policy”.




  3. via monday.api: It sends a request to the v2/ endpoint. I got a response from Monday, “status_code: 500, error_message: Internal server error”.




Then I tried in Chrome with --disable-web-security:




  1. v2 endpoint: Monday returns error “type: basic, status: 500”.




  2. v2/file endpoint: It works, files are uploaded. But of course, because of --disable-web-security, this is not a solution for the app.




  3. via monday.api: Monday returns error “error_message: Internal server error, status_code: 500”.




I tried all this in different API versions, and with published versions with uploaded zip code.


Then I tried POSTMAN:




  1. v2 endpoint, API-version 2024-10: I got “500 Internal Server Error”.




  2. v2 endpoint, API-version 2024-07: I got the error “Variable $file of type File! was provided invalid value”, “Expected value to not be null”.




  3. v2/file endpoint: File is uploaded!




My conclusion is that Monday disabled the v2 endpoint for uploading files. The v2/file endpoint is working fine, but because of the CORS issue, it cannot be used for client-side upload.


Maybe someone has the same issue or a solution for how to upload files client-side. I would be very grateful.


Just to add the monday.api code:


let query = `mutation add_file($file: File!) {
add_file_to_column (item_id: ${itemId}, column_id: "${columnId}", file: $file) {id}
}`;

this._monday.api(query, { variables: { file: newFile } })
.then(response => console.log(response))
.catch(error => console.error(error));

Have you tried changing the URL to https://api.monday.com/v2/file?


See Assets (files) in the docs.


The URL you are using may have recently stopped working


Thanks for the reply.


Yes, I have tried using the /v2/file endpoint as mentioned in the Assets (files) documentation. As I mentioned, the /v2/files endpoint is working, but if you have a client-side application like I do, it does not work because of a CORS issue.


I am hoping that someone can confirm whether Monday has stopped uploading files via the /v2 endpoint, or if this is some “glitch” on Monday’s side that they are fixing.


It’s strange that monday.api is still using the /v2 endpoint for uploading files, which does not work now.


Regarding the /v2/files endpoint, it has this CORS error. I have tried to find some solutions on this forum, but they are old and say that the published build works without the CORS issue (cors-issue-when-uploading-file-with-api). Now it does not.


Just to say that I have received an answer from Monday support:



It would be nice if they put this in the Monday API documentation. I made a server-side solution with the /v2/file endpoint that works perfectly. Thanks to support, they were quick and helpful.


Reply