Hello everyone,
I’m facing a very frustrating and persistent issue with my self-hosted n8n instance (running on Docker) and I’m hoping someone can provide a new perspective.
I’m trying to send a JWT token generated by a Node.js script to an HTTP Request node for authentication with a BoondManager API. The problem is that the HTTP Request node consistently throws the following error:
Invalid character in header content ["x-jwt-client-boondmanager"]
What I’ve already tried:
-
Modifying the Node.js script: Changed
console.log(token)toprocess.stdout.write(token)to prevent newlines (\n). This did not work. -
Cleaning the output in n8n: I’ve tried multiple expressions in the
Edit Fields(Set) node to remove newlines, but thestdoutoutput seems to be corrupted:-
{{ $json.data.stdout.trim() }} -
{{ $json.data.stdout.replace(/[\n\r]/g, '') }} -
{{ $json.data.stdout.toString().replace(/[\n\r]/g, '') }}
-
-
Observing the output: When I use the
replace()function, the output shows more and more\ncharacters each time, which is highly unusual. This suggests a deeper problem with how theExecute Commandnode handles the output stream from the shell. -
Using environment variables: I tried exporting the token as a variable on my host system and referencing it in n8n (
{{ process.env.BOOND_TOKEN }}), but this failed because n8n in Docker cannot see the host’s environment variables. -
Hardcoding the token: I directly pasted the raw token string into the
Edit Fields(Set) node, and the workflow succeeded. This confirms that the token itself is correct and the issue is purely with the data being passed from theExecute Commandnode. -
Updating n8n: I’ve updated n8n from version
1.109.2to1.111.0, but the issue with theExecute Commandoutput persists.