FusionAuth
    • Home
    • Categories
    • Recent
    • Popular
    • Pricing
    • Contact us
    • Docs
    • Login

    Webhook Error

    Scheduled Pinned Locked Moved
    General Discussion
    3
    3
    1.6k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P
      paul 1
      last edited by

      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,
      -Paul

      webhook 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)

      mark.robustelliM A 2 Replies Last reply Reply Quote 0
      • mark.robustelliM
        mark.robustelli @paul 1
        last edited by

        @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?

        1 Reply Last reply Reply Quote 0
        • A
          attractivecolt0219 @paul 1
          last edited by

          @paul-1 said in Webhook Errordrift hunters:

          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,
          -Paul

          webhook 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)
          Your webhook is timing out. Try:

          1. Increase FusionAuth timeout in webhook settings.
          2. Ensure your webhook responds quickly (log timestamps).
          3. Test manually with Postman/curl to check response.
          4. Fix tenantId parsing in test mode.
          5. Check firewall/network issues if self-hosted.

          Let me know if you need more help!

          1 Reply Last reply Reply Quote 0
          • First post
            Last post