How do you setup Webhooks for local testing?
-
I can't seem to get Fusionauth to hit localhost:3000/webhooks but it does seem to work on webhook.site instead.
-
First make sure to check
Home -> Settings -> Webhooks
validate that you have something similar to the below screenshot.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.
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"
- Update your webhook settings in
Home -> Settings -> Webhooks
by changinghttp://localhost:3000
tohttp://host.docker.internal:3000
like below
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 -
@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.