I recently reinstalled windows, and am having issues accessing my n8n locally via tunnel access, and webhooks are not triggering. On the previous windows installation, I had no issues with these working.
Steps to reproduce:
- I installed windows fresh (v. 24H2), and then installed only NodeJS, then n8n via npm.
- I run n8n without tunnel, I can access it via localhost. I created a simple webhook node, and tested triggering it on the same machine with Postman, and that worked fine.
- I then change the IP address of the n8n instance (via the .env file) to the machine’s IP address. I can successfully access the instance from the web browser with that IP:Port.
- I open the same workflow with the simple webhook I created earlier. The test URL is now the IP address instead of “localhost”.
- Everything up to this point is working fine, and worked fine on the old windows installation too.
- However, now when I copy the test URL, paste it into another device on the local network, and try triggering it, the webhook node acts like nothing happened.
- I then stopped the n8n instance, and ran it again with “n8n start --tunnel” so I can try accessing it via the tunnel mode.
- I can access n8n via the local IP as before, but if I try accessing it via the tunnel URL (e.g. https://xxxxxx.hooks.n8n.cloud/) I get a 504 Gateway Time-out error.
- Going back to the local IP again, I load the macro and run a test webhook listener again, it shows the tunnel URL it’s listening on.
- I copy that URL and paste it into the other local network device, and try sending the trigger. However n8n is not responding, it continues to wait for a response.
Can someone help me debug this please? Where can I find some verbose logs to see more information? I am trying to see what point the failure is occurring.
- I know that the issue is not my network/router, because I can reboot into my old windows (v. 22H2) to test all of this, and everything works perfectly.
- I know that the issue is not a conflicting piece of software, because I fresh installed windows and then only installed NodeJS then n8n via npm immediately afterwards.
- I cannot tell if there is another dependency or windows feature that I have not configured for this to work properly. The online installation instructions don’t mention anything else though.
Information on your n8n setup
- n8n version: 1.56.2
- Database (default: SQLite): SQLite I think, it’s default
- n8n EXECUTIONS_PROCESS setting (default: own, main): Main?
- Running n8n via (Docker, npm, n8n cloud, desktop app): NPM
- Operating system: Windows 11 24H2
Hi @protechtedd , here are some steps you can try to isolate the issue:
1. Check Logs for Errors
To get more verbose logs in n8n, you can start n8n with a higher log level. Here’s how to do it:
-
Set Log Level to Debug:
You can run n8n with the log level set to debug to get more detailed logs. Start n8n with the following command:
n8n start --tunnel --log-level debug
This will provide more detailed output in the terminal.
-
Check n8n Logs:
Look for any error messages or warnings in the terminal or command prompt where n8n is running. Errors related to network connectivity, authentication, or permissions might indicate what’s going wrong.
2. Network Configuration
Since the issue occurs when accessing the tunnel URL and not the local IP, there might be network configuration differences in your new Windows setup.
-
Firewall Settings:
Ensure that your Windows firewall settings allow Node.js and n8n to communicate over the network. Sometimes, fresh installations reset firewall rules.
-
Check if Node.js is allowed through the firewall:
Go to Windows Defender Firewall > Allow an app or feature through Windows Defender Firewall and make sure that Node.js is allowed for both Private and Public networks.
3. Check Tunnel Connection
The tunnel connection relies on an external service to work properly. If there’s an issue with your connection to the tunnel service or your network configuration is blocking certain connections, you might experience a 504 Gateway Timeout.
-
Ping the Tunnel Service:
Check if you can ping the tunnel service domain (xxxxxx.hooks.n8n.cloud
) from your command prompt:
ping xxxxxx.hooks.n8n.cloud
If the ping fails, it might indicate a network issue.
-
Test with Different Networks:
If possible, try connecting through a different network (e.g., a mobile hotspot) to see if the tunnel works. This can help determine if the issue is network-specific.
4. Environment Variables and Configuration
Check the configuration in your .env
file for any discrepancies. Ensure all relevant environment variables like WEBHOOK_URL
, WEBHOOK_TUNNEL_URL
, N8N_HOST
, and N8N_PORT
are correctly set.
- Recheck
.env
File:
Make sure the .env
file contains all necessary environment variables and matches what worked on your previous Windows installation.
5. Test Without Tunnel
If everything works locally without the tunnel, the issue is likely related to network access or the tunnel service.
- Localhost Testing:
Since you mentioned that webhooks work fine when tested locally via Postman, continue testing without the tunnel to confirm local functionality is intact.
6. Potential Missing Dependencies
Though you mentioned you installed Node.js and n8n immediately, make sure you have the following:
- OpenSSL:
Ensure OpenSSL is installed and properly configured. Node.js relies on OpenSSL for secure connections, which may affect tunnel connections.
Let me know if any of these suggestions work for you.
I tried running | n8n start --tunnel --log-level debug
| and that returned this:
User settings loaded from: C:\Users\Admin\.n8n\config
Initializing n8n process
Error: Nonexistent flag: --log-level
I also tried running | ping mycustomtoken.hooks.n8n.cloud
| and got successful results:
Ping statistics for 188.245.86.69:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 116ms, Maximum = 116ms, Average = 116ms
I’ve disabled all firewalls but the issue remains.
The issue exists even without using tunnel, only localhost mode, I cannot reach the webhook from another device on the local network.
I’ve tried stripping down the .env
file but the issue remains. Here is the contents of my env incase it helps:
# Set default URL instead of localhost
N8N_HOST=192.168.1.135
N8N_PORT=5678
N8N_PROTOCOL=http
NODEJS_PREFER_IPV4=true
I’ve tried the above with and without the prefer_ipv4, same result.
I’ve also tried removing the env file entirely, same result.
About OpenSSL: I don’t understand, this shouldn’t need to be “installed”, it should already be bundled with n8n if it is needed for webhooks to work. I do have a copy of openssl.exe
which came bundled with Git for Windows. Can you explain more about this, and also if this is essential then why was this not mentioned in the n8n installation instructions?
Hi there, my apologies, my strength is usually linux and docker installations, so I was incorrect. Per this post, it seems that it needs to be done during the install not the start of the webhook tunnel:
npm install n8n -g --loglevel verbose
Then after it’s been installed with the higher log level, starting the tunnel should show the issue in the logs. All logs will be shown on STDERR and saved to npm-debug.log
file in the current working directory. Let me know if this works.
OpenSSL Clarification
OpenSSL is often bundled with Node.js or other software packages, but it might not always be fully configured, especially in fresh Windows installations. Here’s what you can check:
- Ensure OpenSSL is Correctly Installed: The version bundled with Git for Windows is often sufficient, but there could be path issues or missing libraries.To verify if OpenSSL is accessible:
- Open a Command Prompt and run:
openssl version
- If it returns a version, then OpenSSL is accessible. If not, you might need to add the path to OpenSSL in your system environment variables.
- Check Node.js OpenSSL Configuration: Sometimes Node.js uses its bundled OpenSSL version, and if there’s a misconfiguration or an incompatibility, it can cause issues. Reinstalling Node.js with the latest version or the exact version you used previously can sometimes resolve these issues.
However I think checking the logs should narrow down the issue hopefully.
Okay good news and not-yet-good news!
The good is that adding OpenSSL.exe from Git for Windows to PATH fixed my ability to access Webhooks on the local network from different devices! This is how I had n8n working before, so this is very good.
(this dependency should be added to the Windows instructions page, as it is not clear that this is a dependency which could potentially not be resolved automatically during installation).
The not good news is that I still cannot access the Webhook via Tunnel mode using the hooks URL from a local device. I’ll try to find some time tomorrow to test the --loglevel verbose as you mentioned.
Just to be clear about that, I have to install n8n again with the verbose arg, just so I can see verbose logs of the Webhook not working? Aka, it is not enough to just use something like n8n start --loglevel verbose
is that correct?
1 Like
Happy to hear you’re making progress!
Yes, I believe npm is what actually does the logging, so when you enable it in npm, it then logs anything you do within n8n, including starting the tunnel. So I believe you will need to reinstall it to enable logging.
Hello again. I just caught some free-time to debug this further. Here are my results:
I ran the | npm install n8n -g --loglevel verbose
| command and let it install. Then I ran | n8n start --tunnel
| command to run n8n.
I logged in via browser and used a Webhook trigger node to test. It has a tunnel URL, which I copy pasted into a separate device on my network. I tried triggering it, but nothing happens, as was happening before all this testing.
Oddly, there is no npm-debug.log
file as you mentioned. I have a system-wide file indexer (Everything by voidtools) and it found no copy of a file named that anywhere on my system. Could it be named something else on Windows?
I tried using a fuzzy search for just “npm” and “debug” and “log” and the closest thing I found was a file called 2024-09-04T20_18_04_355Z-debug-0.log
within my Local\npm-cache\_logs\
folder. Within it is some logging I think related to n8n, but I am not seeing any errors.
What should I try next?
Hi there, let’s see if we can make progress:
- Check the Correct Log File: It seems like the log file you’re seeing (
2024-09-04T20_18_04_355Z-debug-0.log
in the Local\npm-cache\_logs\
folder) might be the correct one for capturing npm logs. The npm-debug.log
filename mentioned earlier in the stackoverflow post could have been a general reference, as npm’s logging format sometimes varies by installation method or version. Review this log file thoroughly for any warnings or errors related to n8n or tunnel connections.
- Run n8n with Debug Logs: Even though reinstalling n8n with
npm install n8n -g --loglevel verbose
sets up verbose logging for npm, you may need to start n8n with detailed logging. To ensure you capture all possible debug information, try running n8n with both npm and n8n debug settings to see if that works:
n8n start --tunnel --log-level debug
I also took a look at the comments in the stackoverflow post and they refer to this documentation for npm’s logging which may help.
Hello again. I am returning to this before the thread expires. I am still having this issue. The dynamic webhook URLs are not reachable from either inside nor outside my network.
Is it possible to revert the webhook URL generation to a local IP again? (as it used to be before the change months ago)
If not, then I need some more help finding an answer to why it’s happening to me. Thanks