Question

Webhooks unsubscribehook doesn't work


Although we’re successfully subscribe, when we turn off our zap, hook does not deleted from our database.
data returned from subscribehook is:
{ message: ‘Hook added’, id: ’60b88dfda8b6dd0017692fd5’ }
isn’t bundle.subscribeData.id supposed to give id from the object above.


4 replies

Userlevel 6
Badge +9

 

I’ve looked over this a couple times and can’t spot an issue that would explain what you’re seeing.   

Have a look in the Monitoring section of the developer tool. Notice that unsubscribe is invoked by the platform, but there’s no http request logged at all, to say nothing of the fact that your id is not in subscribeData.

I notice you’ve built a helper function to wrap this code. First thing to do is make sure that the performUnsubscribe function is assigned in the particular trigger you are testing with. 

Next I’d start adding z.console.log statements throughout the call chain to isolate the issue. Make sure your unsubscribe code is actually getting executed at all.  Make sure that JSON parse is actually returning a good object with the id value. Etc.

 

The await on the return statement is not necessary.  You can just return the promise chain. I can’t think of why this would explain the issue, but it’s something my eyes keep going back to. Looking for differences between this and the basic example.

 

 

 

Actually the main problem is, While I’m testing locally, I can monitor console.log value but I don’t know how to monitor z.console.log(bundle.subscribeData) value when I test the zap from the website.
Can you please tell me where can I see bundle.subscribeData when I’m console.logging it.


When I type “zapier logs --type=bundle”, There is no subscribeData in the bundle.
I opened zap and zapier successfully subscribed to targetUrl (it is added to our database)

Userlevel 6
Badge +9

To see the output of your z.console.log statements use zapier logs --type=console

To see all the options check  zapier logs --help or visit https://zapier.github.io/zapier-platform/cli

You can also check out the Monitor section in the UI tool (https://developer.zapier.com/)

You’re going to want to check more than the content of subscribeData… that’s a symptom of something going wrong earlier in the process.  And as mentioned earlier i wasn’t even seeing a network request corresponding to the invocation of the unsubscribe function. I’d put log statement all over the place to trace it back and confirm everything is working the way you expect it to.

Reply