Unable to Get JSON Output of Custom JS


I want to get the Hostname where my N8N is installed and use it for multiple logging.
Currently I am using this JS code but unable to get the Output in JSON. I am able to see it only in the variable Selector.

Final Output of Set

Hey @Asit_Joshi, I just tried this out and faced the same issue. Perhaps @jan has an idea why this might be happening? :slight_smile:

1 Like

The variable location exists only in the browser, not in the backend (Node.js). For that reason does it display you a value there but then nothing when you execute it, as that runs then in the backend.

Depending on how you have n8n configured you can get that information from environment variables. For example {{ $env.N8N_HOST }} will return the value from N8N_HOST if you have it set.

Hope that helps!


Thanks @jan :slight_smile:

You are welcome. Happy if it helped!

Have fun!