Skip to main content

Hi,


I’m trying to create sub-items inside an item but Node seem to only send 6 requests to Monday at a time…

I am making the request through fetch.


I am cycling through an array. Each cycle a request is sent to node, which then sends a request to Monday. I can confirm that the first 6 cycle the node more than keeps up, but after this it stops sending request.


If I restart the node, it will send another 6 request, if I restart it again, it will send another 6 requests, and so on until the backlog has been emptied.


Any ideas?

Hi @AndreasGT


Do you know what the API call returns, does it return an error (which can still be a 200)? Is there a change that you hit rate limiting?


It is hard to believe this is Node specific, Node just posts request to the monday API. I advise to have a good look at the API response.


Hi @basdebruin ,

Thank you for showing interest, sorry for my late reply!


I got CORS error when running the subitem request through my root. I do not get this error when using other monday post or query features. Hence the Node.


I get no errors, only a broken promise error when I kill the Node.


When I send the requests manually, without using a loop I get Node console.log response that I have received the request for the first 6 subitem request. Then the Node stops responding and I have to kill it to get another 6 request - rinse & repeat until the queue is empty.


Sending requests to another API using very similar code (GET instead of POST) works!

Here is my code.

ROOT:


//createdItemID is previously created Item Id that the subItem will be posted into
var info = createdItemID + ',*^GT^*,' + "PlaceholderText";
var requestOptions = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
}
}

fetch(`/subitem/${info}`, requestOptions)
.then(console.log("Sent subitem request!"))
.catch(error => console.log('error', error));

}



And Node:



app.post("/subitem/:info", async (request, response) => {
console.log("Node has received a sub item request!");

const info = request.params.info.split(",*^GT^*,");
const itemId = parseInt(info[0]);
const itemName = String(info[1]);

console.log(itemId);

let query =
"mutation($itemId:Int, $itemName:String){ create_subitem (parent_item_id: $itemId, item_name: $itemName){ id board { id }}}";

fetch("https://api.monday.com/v2", {
method: "post",
headers: {
"Content-Type": "application/json",
Authorization:
********************,
},
body: JSON.stringify({
variables: { itemId, itemName },
query: query,
}),
})
.then((res) => res.json())
.then((res) => console.log(JSON.stringify(res, null, 2)))
.catch((error) => console.log("error", error));
});

Thanks in advance!


Hello @AndreasGT!


This looks like a very specific issue. Could you send us an email to appsupport@monday.com with this same information + the complete response you are getting so we can take a look?


Looking forward to hearing from you 🙂


Cheers,

Matias


Reply