https://discord.gg/botpress logo
Request failed with status code 502
# šŸ¤help
b
I need help. My bot is working fine in the emulator, but not in preview or in production (WEBCHAT). The image shows the only error I see. I type a greeting, and it's received, but then it acts like it's going to respond but doesn't say anything and just stays like that. This happens to me in preview and in bubble chat as well. https://cdn.discordapp.com/attachments/1536079367074091019/1536079367883460738/image.png?ex=6a7a18e4&is=6a78c764&hm=546451dbbe0ad1ed50fdcecfe7f38ac288b25408c32e1659b462102bd9304ef9&
a
The fact that it works in the emulator but fails in both Preview and Webchat, combined with the 502 on message_created, suggests the conversation is reaching the bot but something in the runtime/published configuration is failing when it tries to generate the response. I’d first compare the published version/environment variables and integrations against what the emulator is using, especially any LLM, HTTP/API, or Execute node. Quick question: are you using any external API/LLM integration or environment variables in the flow, and if so, does the 502 happen immediately after the flow reaches that specific node?.
b
I am not using any external API/LLM integrations or environment variables, and I haven't seen any errors other than the one I already shared. Everything works perfectly in the emulator, but it doesn't work in the 'preview' or the 'Chat bubble'. It also doesn't work in the webchat on my website.
I haven't touched those hooks, but I see it's always the last thing the log shows.
I can't figure out how to fix this; I've been working on it all day. I don't understand why it fails in Preview and in Bubble Chat but works in the emulator. They’re supposed to be using the raw script, but I’m still getting the same behavior. That error mentions a
userData
variable that I clearly don’t use anywhere in my flow—that is, no node uses it. I imagine it’s a BotPress variable. I’m also not sending user values from WebChat, where it’s deployed. Anyway, it doesn’t make sense for me to check the implementation there because Preview and Bubble Chat should at least work.
a
I went through the new log carefully, and I think we’ve got a much clearer lead now. The message is reaching Webchat, but it’s failing inside "before_incoming_middleware", specifically around "adjust-transcript-user". The "userData" 404 is happening there, before the bot gets to process the message, which would explain why it works in the emulator but just hangs in Webchat/Preview. I wouldn’t change your Webchat code yet. I’d check that hook first and see why it’s trying to read "userData" when your flow doesn’t use it. It could be an old hook/config reference rather than something in your actual workflow. If you send me the code/config for "adjust-transcript-user" (or a screenshot of your Hooks section), I can trace it with you and tell you exactly what I’d change rather than having you keep guessing. @billowy-morning-42410
b
OK, here's what I see in the hook: async function hook(event: IO.IncomingEvent): Promise { /** Your code starts below */ // IMPORTANT LEAVE THIS ALONE if (!event.state.session.fullHistory) { event.state.session.fullHistory = '' } event.state.session.fullHistory = event.state.session.fullHistory +
user : ${event.payload.text}
+ '\n' /** Your code ends here */ }
I managed to fix it by exporting the bot, creating another workspace, importing it there, and that was it—now it's working. I think that workspace was a legacy one. There was no reason for that error to occur. Thanks again for your help @alert-cat-82573 . šŸ‘šŸ»
e
intersting
If you don't mind, can you explain about it in more detail?
as you can know, this is server error
6 Views