Invalid API Key on BotPress Variables
# 🤝help
f
I'm getting a 401 incorrect API key error anytime botpress tries to extract a variable from user input, a name to be specific in this case. Whenever I prompt the user to input a name and store that in a name variable my bot stalls out and I get an error because it was not able to extract the name from the user input. Looks like its botpress using chatgpt on the backend to extract user info for those kinds of fields and the API is saying its not working for me. I did copy import this bot from another one i made (and exported) if that makes a difference. Here's the error log: ``` ``` https://cdn.discordapp.com/attachments/1131327303494946836/1131327303608172688/message.txt
Seemingly important parts of the log
Copy code
DM Error while executing hook conversation_turn_ended of agent "SummaryAgent"
HTTP (post) URL chat-gpt/query
Received "Invalid bot API key provided"
Request failed with status code 401
AxiosError: Request failed with status code 401
    at settle (/var/task/customer_code.js:60:1062)
    at IncomingMessage.handleStreamEnd (/var/task/customer_code.js:61:8380)
    at IncomingMessage.emit (node:events:525:35)
    at endReadableNT (node:internal/streams/readable:1359:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  code: 'ERR_BAD_REQUEST',

https://cdn.discordapp.com/attachments/1131327303494946836/1131328530647629987/Screen_Shot_2023-07-19_at_1.55.21_PM.png

b
hmm
what is the variable typing you're storing the name in?
It should be a string (the Tt icon)
f
The weird thing is this is exact same bot that I exported from another bot I made, then I just imported into a blank template. It works fine in the original bot but it does not work on the import
Variable type was the "Person Name" Capture Information type from the card options
b
ah I see
f
So looks like it gets stored as an object with First Name and Last Name as keys to that object, and if I'm reading the error log right it looks like botpress is using chat-gpt to extract the first and last name from the user input and create the object, and its that api key for botpress to chat gpt that is throwing the error
b
it's just odd that I can't replicate the problem

https://cdn.discordapp.com/attachments/1131327303494946836/1131330957161545839/Screenshot_2023-07-19_at_5.05.12_PM.png

so it looks like something's gone wonky with the import/export of your bot
f
It works there for me too but when I try to use it in the share my chatbot or webchat integration thats when the error is thrown
b
ah
b
did you hit publish?
f
I did and it wasn't working still but i can try again
This happened yesterday too with another one i duplicated and magically started working this morning so 🤞
Ok so now its working...
Guess I'll just make a habit of trying to publish multiple times lol
yeah I was able to get mine to work on share as well
it's likely a problem with your bot not showing the latest version (i.e., not having been published)
I agree that we should probably float an error if you try to share a bot that hasn't been published
f
Ahhh ok so I probably hit the share button before publishing, tried using it and got the error, then i published but when i went back to the page it mustve been cached or something so it wasn't working until I just republished and cleared cookies and cache just now
b
sounds about right!
easy fix
\o/
f
A model saying you're sharing before publishing would be very helpful for forgetful people like me though!
Thanks so much for the help!
b
happy bot building!
f
Thank yoU!
2 Views