Hi all,
I’m using webhook event handler in my sync gateway. Whenever a particular doc syncs, it is sent as request to an API. Now I tried to upsert the Doc with some changes in the Doc property. My issue is the doc gets updated, but the same document is synced and is sent as an request to an API where the upsert is done. The cycle go infinite times until I stop my API server.
My aim is to update the document that comes as an API request via webhook, and then store it in the main DB server.
Let me know if there is a way to do it.
This is my webhook config.
"event_handlers":{
"document_changed":[
{ "handler":"webhook",
"url":"http://localhost:5000/checkInvoiceSequence",
"filter":` function(doc) {
if(doc.channels){
if(doc.type == "invoice"){
return true;
}
}
return false;
}`
}
]
}
I’m trying to upsert the same doc in the API to the main DB server.
TIA.