Eventing > CURL now work

I follow all steps as given in :
youtube.com/watch?v=U5TwveOLiWE
and Using the cURL Function with the Couchbase Eventing Service

but curl for eventing is not working for me :
os : ubuntu 18.4
couchbase vsersion : 5.5.0

Eventing function code :
function OnUpdate(doc, meta) {
log(‘document’, doc);
var response = curl("h t t p : / / l o c a l h o s t : 30 0 0 / n o t if y ", { method: “POST”, data: doc });
log(‘curl’, response);
}
function OnDelete(meta) {
}

log :
2019-03-04T16:11:34.433+05:30 [INFO] “document” {“click”:“to easddi54asddt”,“with JSON”:“there are no reserved field names”,“_type”:“sms”,“task_status”:“pending”,“a”:“dzgsdsdhghx”}
2019-03-04T16:11:34.433+05:30 [INFO] OnUpdate Exception: noti.js:4

2019-03-04T16:11:34.433+05:30 [INFO] var response = curl('h t t p : / / l o c a l h o s t : 3 0 0 0 / n ot i f y ', {

2019-03-04T16:11:34.433+05:30 [INFO] ^
2019-03-04T16:11:34.433+05:30 [INFO] [object Object]
2019-03-04T16:11:34.433+05:30 [INFO]

Please help me to solve this

Hi,

It seems like there’s an exception being thrown. Could you please use the following code -

function OnUpdate(doc, meta) {
    log('document', doc);
    try {
        var response = curl('http://localhost:3000/notify', {method : 'POST', data : doc});
        log('curl', response);
    } catch (e) {
        log('error', e);
    }
}
function OnDelete(meta){
}

Please deploy the above code, add/change a document in the source bucket and share the application log.

I already try with try and catch, it say request time out in catch

Hi dhavalbhalodia,

I’m happy to say we’re preparing GA version of Curl which is substantially enhanced and easier to use. You can see the improved APIs and usability enhancements here:

Please let us know if you’d like a preview of the above and I’ll be happy to share an early build. Please let me know which OS you’re interested in it.

Bye,
Siri

Thanks Siri, really really appreciate your replay. luckily issue is solved when i update version 6.0.0
really good work for Eventing…

now I just want to know, can i update same document or other document in same bucket via eventing function?
I want to update “task_status”:“pending” to “task_status”:“sent” when event function execute any document

That’s great Dhaval! In 6.0, as we cannot suppress recursion, we don’t allow modifying documents in the bucket that is source of mutations to a given handler. But in the upcoming 6.5 release, we detect and suppress such recursion automatically, and so you can use Eventing’s KV bucket operation to modify the documents of the source bucket (“Source Bucket Mutation”). That’s yet to be released, so for now you could work around using two buckets, or use the pre-release build I mentioned earlier for development and testing purposes.

Bye,
Siri

Thanks again. I appreciate your quick replay. Now let’s wait for 6.5. Is it possible for me to know approx release date of 6.5

I can’t approximate a date due to all the variables involved in the release, unfortunately!

But we do have DPs from time to time, so do ping me if you want to check it out anytime in the future.

Best Regards,
Siri