Receiving 500 error on API call to add file to item

I’ve been working on uploading a file to an item, and I’ve been receiving some cryptic errors from the API. Here’s my code snippet:

return monday.api(`
  mutation addFileToColumn($file: File!) {
      item_id: ${itemId},
      column_id: "${columnId}",
      file: $file
    ) {
`, {
  variables: { file },

where itemId is for sure an existing item (I do this immediately after creation), columnId is files, and file is a javascript File instance.

I’ve seen Requesting code example for file upload via Monday's SDK client side, which seems like it might be a workaround. But I wanted to report this to see whether there’s something obvious I’m missing and doing wrong. Note I haven’t tried this in a non-dev environment, so maybe the 500 represents some of the CORS errors being seen in the above topic?


Hey @jakedluhy !

I too would love an update on this and would love to hear any feedback regarding file transfer through monday’s SDK.

You’re right, what I have shown is a work around, and from what I can tell you, I don’t think it’s implemented through the SDK yet. But the possibility is out there with formData rather than file.

I have a feature request submitted here:

If you need help with the workaround, let me know. Good luck.

Hey Jake!

As Pepper mentioned, our SDK doesn’t support file uploads yet. You’ll need to make an HTTP request from your board view to the API directly, which should work fine.

Let us know if you run into any trouble.

Hey @pepperaddict thanks for the help! The one last missing piece for me is how to get the authorization token. Right now I’m building a purely client side app and have been relying on the monday.api function to automatically set the auth token. Do you know of a way to retrieve authentication credentials from the monday sdk when they’re set in a client environment?

@dipro would appreciate any insights into this as well!

Hey @jakedluhy :wave:

I’m afraid that at the time, you will not be able to use a client-side authentication process in order to upload files. This can only be achieved by using OAuth flows, and thus you would need to set up the authentication on your end.

Does that make sense? Let me know :slight_smile:


Yep I got an answer here: How to get auth token from client app