0

I am new to monday.com and also to GraphQL, so I had to figure everything from scratch.

Currently I am developing app, where I need to upload file to specific database column. Columns looks like this:

files_1 : {
    id: "files_1",
    text: "https://something.monday.com/protected_static/ID/resources/ID2/image.jpg",
    title: "Dedication Image",
    type:  "file",
    value: (JSON.stringify value of text...)
}

When I want to access photo and display it on web, I need to query with assetID and then I receive publicURL. That was for querying.

What I need is upload file from web to monday.com

I triend every single solution that I had in mind or I found on google, but nothing helps me.

Here is my function for uploading picture:

    var formData = new FormData();
    formData.append("query", `mutation addFile{add_file_to_column (item_id: 3286592696, column_id: files_1, file: ${file}) {id}}`);
    formData.append('map', '{"image":"variables.file"}');
    formData.append('image', file);

    res.json({ response: formData });

    const config = {
        headers: {
            'Content-Type': 'multipart/form-data',
            'Authorization': token
        }
    };

    await axios.post(url, formData, config)

This is same query as from Postman, where it works without problem. How can I send this query from my client? Every single request ends with CORS problem.

I am using React.js (Next.js) with antDesing.

Thank you

Marek
  • 95
  • 1
  • 13
  • That means monday.com server has CORS restrictions, so the requests won't work from the client-side. See [NextJs CORS issue](https://stackoverflow.com/questions/65058598/nextjs-cors-issue) for potential solutions in Next.js. – juliomalves Oct 03 '22 at 18:36

0 Answers0