Bug: OpenAI Authenticator node throwing odd error when in fact API Key is incorrect (whitespace at end of key)

,

I ran into some weird behavior of the OpenAI authenticator node.

I kept getting the below message after having copy and pasted my API key into the credentials configuration node:

After trying to debug and restarting the computer and various other things I tried one simple thing: Putting in the API Key again. I noticed that from previous copy & paste there was one character of white space selected - after I removed that it worked again.

I then intentionally put in some random characters as API key and got a “normal” message indicating API key is incorrect:

I then added in correct API key and added a space at the end and got the first message again.

I observed this behavior in both current Standard Release (5.8.) as well as Community Hacking Days Release Candidate (5.8.1).

Steps to reproduce:

  1. Copy API Key into Credentials Config Node
  2. Add space at the end at a space
  3. Execute OpenAI Auth Node

Hi @MartinDDDD,
thanks for reporting and for providing all the detailed steps on how to reproduce it.

We were also able to reproduce the issue.

Just to summarize the problem: trailing spaces make the API key malformed when it is sent in the authorization header, causing the request to fail before it reaches the OpenAI API and therefore resulting in a different error than an invalid API key.

We have created a bug ticket and will address this in an upcoming bug-fix release.

Thanks again!

Seray

2 Likes