Hello. I have set up an n8n service on my Google Cloud Run, with WEBHOOK_URL, N8N_EDITOR_BASE_URL, and N8N_PUBLIC_URL filled in. I am currently setting up a LLM chat workflow, and it works fine in the editor. However, in the “When chat message received” node, after I turn on the “Make Chat Publicly Available” switch (which generates an URL that is my WEBHOOK_URL/webhook/{workflow-id}/chat), when I click on it it shows a 404 Not Found screen.
Can anyone help me regarding this issue?
Since the n8n error page is being displayed, it confirms that the request is indeed reaching your n8n instance. This suggests that the issue isn’t with your network or Cloud Run routing but with how the chat endpoint is registered within n8n.
A few points to consider:
Endpoint Registration: The generated URL (e.g., /webhook/<workflow-id>/chat) might not be correctly registered. Double-check if the workflow is set up correctly, and try regenerating the chat URL.
Configuration Discrepancies: Ensure there’s no mismatch between your environment variables (like WEBHOOK_URL, N8N_PUBLIC_URL) and the actual endpoint. Small differences, such as trailing slashes or subdomain differences, can lead to the resource not being found.
As you can see, my “workflow” is literally just a single chat node for testing purposes. I have done this on localhost and the chat UI shows up fine.
Regarding the env variables, currently aside from the Postgres DB variables, I have WEBHOOK_URL, N8N_PUBLIC_URL, N8N_EDITOR_BASE_URL all being identical, which is the URL Cloud Run gave me. I also have N8N_ENDPOINT_WEBHOOK = webhook, and N8N_DISABLE_PRODUCTION_MAIN_PROCESS = 1.
Does the WEBHOOK_URL and the other have to be in some format? Currently it’s “https://n8n-service-{id}.{region}.run.app”. This works fine for things like Google SSO, but I’m not sure if this is the reason why the chat URL is breaking. The chat URL is currently “{WEBHOOK_URL}/webhook/{id}/chat”. Do I perhaps have to add a trailing slash or something?
I have also tested using a webhook and sending in POST the same variables as the chat node (chatInput, sessionId, action), and this works fine too.
I’m kind of lost here, as I have never encountered this error before, but I’ll try again with some essential troubleshooting steps.
Environment Variables & Trailing Slashes:
Ensure that your WEBHOOK_URL, N8N_PUBLIC_URL, and N8N_EDITOR_BASE_URL exactly match your Cloud Run URL. Even a missing or extra trailing slash (for example, using https://n8n-service-{id}.{region}.run.app/ versus without the slash) can lead to URL misformation. It’s worth trying to add the trailing slash if it isn’t there.
Logs & Version Considerations:
Check the Cloud Run logs for any errors related to the registration of the chat endpoint.
Main Process Interference
Verify that using N8N_DISABLE_PRODUCTION_MAIN_PROCESS=1 isn’t interfering with endpoint registration.
I’ve also noticed that using true and false is the standard. Using 1 and 0 should work, but maybe sticking to the standards could be good practice and might fix some issues.
Yes, I am very confused too hence why I have to ask here. Should I post this on the github as well?
I am 100% sure my environment URL exactly matches the Cloud Run URL - I copy pasted it. I have tried with and without a trailing slash, the error persists.
There is literally no logs regarding this error, nor can I see any issue in the inspector network tab. I have also tried on multiple browsers - Chromium based, Firefox, etc. and no results. I have changed N8N_DISABLE_PRODUCTION_MAIN_PROCESS to use true and it doesn’t make a difference.
I can try. But I noticed something. The n8n service I have on Cloud Run is currently running through a Serverless VPC connector. Would this be the problem? I’m not really sure, because if that is the case it shouldn’t connect, not meet 404 after getting into the N8N UI.