Upload File via SDK received 500 error

Hello,

I tried uploading files via monday SDK but I received 500 error message. It was just a simple monday.api call like this:

monday.api(`
    mutation add_file($update_id: Int!, $file: File!) {
        add_file_to_update (update_id: $update_id, file: $file) {
            id
        }
    }
`, {
    variables: {
        update_id: itemId,
        file: file
    }
}).then((res) => {
      console.log(res);
});

SDK version: 0.2.1

One thing worth noting though, the monday.api() send the POST request https://api.monday.com/v2 rather than https://api.monday.com/v2/file that is suggested in API docs and community.

This is the response I got back:

{"error_message":"Internal server error","status_code":500}

Any help and advice is appreciated, thank you.

Hello there @pen123,

monday.api uses a different type of HTTP request than the one needed for uploading files (multipart/form-data).

That is why you are getting a 500 error in this case.

So you can not use monday.api to upload a file.

Let us know if you have any other questions!

Cheers,
Matias