Weird bug. An invisible character affects API connections

In order to connect to a certain API, I need to pass a login token that is base64Encode.
For some reason if I don’t do trim() the base64Encode I get is different.
Meaning there is some invisible character being added somewhere by n8n and I can’t figure this out.

The first is with trim()
The second row without
Look at the result - looks the same. right?

image

Wrong! to test this i set base64Encode. as you can see that they are different. Similar, but different.

Please share your workflow

Information on your n8n setup

  • n8n version: 1.48.3
  • Database (default: SQLite): pgsql
  • n8n EXECUTIONS_PROCESS setting (default: own, main): default
  • Running n8n via (Docker, npm, n8n cloud, desktop app): docker
  • Operating system: ubuntu server

Hi @shlomi

That is weird. Wanted to check but the pinned data seems to be empty. Can you provide the pinned data?

For some reason it wasn’t included in the copy paste. This is the json.

you can also test it vs applicationKey and applicationKeyId it works without need to trim.

[
  {
    "AccountAppKeyID": "003e36673f2c67c0000000001",
    "applicationKey": "K003l8ta9sTXtSGqLaXyGq+2hQzDMR0",
    "applicationKeyId": "003e36673f2c67c0000000001",
    "data": "K003l8ta9sTXtSGqLaXyGq+2hQzDMR0"
  }
]

Hi @shlomi
Thanks.
They are identical. So it is something that doesn’t like to be copy-pasted here.
image

n8n should not add anything and I have not seen it before, so it is probably the source of this data that is adding some characters.
Where are you getting this data from?

Please check the third node how it looks after base64Encode

Ah sorry, was looking at the wrong thing indeed. :sweat_smile:
Ill have a look and get back to you.

image
image
Seems like something is wrong in the data part. Where is this data coming from?

the data comes from another workflow (I keep the key encrypted in our DB and decrypt it when I need to use it)

Ok, so the data that you are passing to this thing seems to get an unknown character somewhere. You will need to find out where and see if you can fix it.
But to be honest I wouldnt bother. as I use trim() a lot to be sure no spaces or similar are there, it doesn’t really matter.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.