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

    How do you setup Webhooks for local testing?

    Scheduled Pinned Locked Moved Unsolved
    Q&A
    2
    3
    705
    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.
    • A
      Alex Patterson
      last edited by

      I can't seem to get Fusionauth to hit localhost:3000/webhooks but it does seem to work on webhook.site instead.

      1 Reply Last reply Reply Quote 0
      • A
        Alex Patterson
        last edited by Alex Patterson

        First make sure to check Home -> Settings -> Webhooks validate that you have something similar to the below screenshot.

        Screenshot 2023-07-07 005554.png

        Please note if you try turning on an event that is license only you will not be able to save correctly (this should be fixed in newer releases).

        DOCKER

        If you are using Docker you will need to setup two things correctly.

        1. extra_hosts on the fusionauth container in your docker-compose.yml like below
          fusionauth:
                image: fusionauth/fusionauth-app:latest
                depends_on:
                  db:
                    condition: service_healthy
                  search:
                    condition: service_healthy
                environment:
                  DATABASE_URL: jdbc:postgresql://db:5432/fusionauth
                  DATABASE_ROOT_USERNAME: ${POSTGRES_USER}
                  DATABASE_ROOT_PASSWORD: ${POSTGRES_PASSWORD}
                  DATABASE_USERNAME: ${DATABASE_USERNAME}
                  DATABASE_PASSWORD: ${DATABASE_PASSWORD}
                  FUSIONAUTH_APP_MEMORY: ${FUSIONAUTH_APP_MEMORY}
                  FUSIONAUTH_APP_RUNTIME_MODE: ${FUSIONAUTH_APP_RUNTIME_MODE}
                  FUSIONAUTH_APP_URL: http://fusionauth:9011
                  SEARCH_SERVERS: http://search:9200
                  SEARCH_TYPE: elasticsearch
                  FUSIONAUTH_APP_KICKSTART_FILE: ${FUSIONAUTH_APP_KICKSTART_FILE}
            
                networks:
                  - db_net
                  - search_net
                  - mailcatcher_net
                restart: unless-stopped
                ports:  
                  - 9011:9011
                volumes:
                  - fusionauth_config:/usr/local/fusionauth/config
                  - ./kickstart:/usr/local/fusionauth/kickstart
                extra_hosts:
                  - "host.docker.internal:host-gateway"
        
        1. Update your webhook settings in Home -> Settings -> Webhooks by changing http://localhost:3000 to http://host.docker.internal:3000 like below

        abce3662-cf0b-4ab8-82e8-9287637b717a-image.png

        Side note, if you are using WSL on Windows you will also need to go into PowerShell and map WSL2 (running on 172.19.131.67:3000) to <Windows>:3000

        You can find additional details about accessing the host machine at the below link:
        https://fusionauth.io/docs/v1/tech/installation-guide/docker#accessing-the-host-machine

        M 1 Reply Last reply Reply Quote 0
        • M
          maximkvilton @Alex Patterson
          last edited by

          @alex-patterson It seems like you are experiencing issues with Fusionauth not hitting localhost:3000/webhooks but working correctly on webhook.site. There could be several reasons for this behavior:

          Configuration: Double-check your Fusionauth configuration to ensure that the webhook URL is correctly set to "localhost:3000/webhooks" and that there are no typos or errors in the URL.
          Firewall or Network Restrictions: Make sure that there are no firewall or network restrictions preventing Fusionauth from accessing localhost. Sometimes, security settings may block external services from accessing localhost.

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