Webhook errors when using self-signed certificate or untrusted root CA

I’ve been using webhooks successfully without any issues for the past few days. Now when I try to publish to my webhook, I get a hook error after a hook sent (I have never seen the hook sent before in the output from the particle CLI).

{"name":"myrequest","data":"{\"id\":\"36002d00084734323236323\"}","ttl":"60","published_at":"2015-09-13T22:17:03.095Z","coreid":"36002d000847343232363230"}
{"name":"hook-sent/myrequest","data":"undefined","ttl":"60","published_at":"2015-09-13T22:17:03.110Z","coreid":"\u0000\u001bkN�"}
{"name":"hook-error/myrequest/0","data":"{}","ttl":"60","published_at":"2015-09-13T22:17:03.158Z","coreid":"\u0000\u001bkN�"}

Of course after 10 failed attempts, I have to delete the webhook and recreate it or else wait a minute to try again.

When I check the host that the webhook should be accessing, I see no attempts to access it from particle. I can curl the URL that the webhook should be accessing without issue. I’m using a self-signed cert for SSL.

It should be noted that I’m using a basic authentication protected URL. I’m also using the “auth” webhook option to encode the username and password.

Is something going on with the cloud at the moment?

@Dave, it looks like you’re the guy to ping about this since I’ve seen your name in other parts of the communities. Can you confirm if anything changed Sunday evening with regards to how your webhook client accesses hosts that use self-signed certificates for SSL? I’m more and more suspicious that’s what’s happening here. Thanks in advance!

It looks like I was wrong about the self-signed cert. I just bought a signed cert and I’m still having the same issues. I’ve also turned off authentication. Now I’m at a complete loss unless you’re blocking access to the host that the webhook is trying to access. My webhook is now dead simple and results in the same behavior as I posted originally.

{
    "event": "test",
    "url": "https://mysite.com",
    "requestType": "GET",
    "mydevices": true
}

Replied in a PM, but for anyone following along, it looks like this was a case of not having any devices claimed to the account. So claiming at least one device should fix it.

Thanks!
David

Hmm. @Dave, I do have two devices claimed with this particular account. At the moment, I’m testing purely from the particle CLI. There seems to be a problem with the specific URL that I forwarded along to you.

1 Like

I’ve also reached out to particle support on this. They can reproduce the behavior to my specific URL. For anyone following along, I will update the post with whatever they manage to find. I’m curious if anyone else is experiencing the issue.

@Dave suggested in a PM that I add rejectUnauthorized=true in the webhook. I added it and everything started working again. Thanks, @Dave!

A couple of things that the particle team might want to consider:

  1. Perhaps you should update the webhook docs with this flag. I didn’t know that it existed and it would helped tremendously. Thanks for adding it here!
  2. Now that I am not using a self-signed cert, you might want to check the webhook server to ensure that you trust the root CA I’m using. I’ll send you the cert in a PM.

Thanks again!

1 Like