Webhook Error
-
Hello,
I've had working webhooks for sometime and recently added the ability in my application to modify the user registration which is sending a user registration update. I can see on my side that I receive and process the webhook in a few seconds using the C# code below. Also see below for the content of the Webhook log in FusionAuth.
Other random note since I updated to 1.55.1 I don't seem to be able to test webhooks, while developing my handler the test feature worked fine. If I cut and paste the json from the log and paste into the test my webhook app throws exceptions on trying to parse the tenantID portion, regardless of what webhook type I test. I've had a few moving parts so this issue might be on me, but I can't put a finger on it.
Any ideas on what might be going wrong here?
Thanks,
-Paulwebhook code:
using (StreamReader reader = new StreamReader(context.Request.Body, Encoding.UTF8))
{
try
{
string jsonString = await reader.ReadToEndAsync();
using (JsonDocument document = JsonDocument.Parse(jsonString))
//lots of code
context.Response.StatusCode = 200;
Log.Information("FusionAuth Success");
return jsonString;
}Webhook log info below:
Webhook [http://xxxxxxxx:8080/webapi/fusionauth] returned response code [-1] when sending [UserRegistrationUpdate] event with Id [xxxxxxxxxxxxxxxxxxxx].
Exception:
java.net.SocketTimeoutException: Read timed out
at java.base/sun.nio.ch.NioSocketImpl.timedRead(NioSocketImpl.java:278)
at java.base/sun.nio.ch.NioSocketImpl.implRead(NioSocketImpl.java:304)
at java.base/sun.nio.ch.NioSocketImpl.read(NioSocketImpl.java:346)
at java.base/sun.nio.ch.NioSocketImpl$1.read(NioSocketImpl.java:796)
at java.base/java.net.Socket$SocketInputStream.read(Socket.java:1099)
at java.base/java.io.BufferedInputStream.fill(BufferedInputStream.java:291)
at java.base/java.io.BufferedInputStream.read1(BufferedInputStream.java:347)
at java.base/java.io.BufferedInputStream.implRead(BufferedInputStream.java:420)
at java.base/java.io.BufferedInputStream.read(BufferedInputStream.java:399)
at java.base/sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:827)
at java.base/sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:759)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1690)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1599)
at java.base/java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:531)
at com.inversoft.rest.RESTClient.go(RESTClient.java:403)
at io.fusionauth.api.service.event.WebhookEventSender.send(WebhookEventSender.java:114)
at io.fusionauth.api.service.event.DefaultEventExecutorService$SenderTask.call(DefaultEventExecutorService.java:102)
at io.fusionauth.api.service.event.DefaultEventExecutorService$SenderTask.call(DefaultEventExecutorService.java:90)
at com.codahale.metrics.InstrumentedExecutorService$InstrumentedCallable.call(InstrumentedExecutorService.java:197)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1583) -
@paul-1 Is it possible that the your code (i.e. //lots of code) is taking too long to process? Can you try to take out most of the code and see if that prevents the time out?
As far as the "testing" goes, it seems odd that there is different data. Have you tried to capture the data actually sent vs what you are testing with and see if there is a difference?