Bad Gateway - Table Errors
# 🤝help
s
Bot can't insert rows into the table, reporting some problems with a gateway that I don't think I can set up. I use Insert Record Card, but it doesn't work properly each time. I could not find a reason why some users have empty conversations, and now it has happened to me. In the logs, there is only information about a bad gateway. How can I fix it or make sure it always works as expected? https://cdn.discordapp.com/attachments/1236625820546633799/1236625820735504424/image.png?ex=6638b10b&is=66375f8b&hm=80e5c9b1caa56090f4d958a38137a2291e5ce3d15cdea75407b129a13e78a4fa&
f
Hey there, Insert records works fine on my end. If you are okay with it, you can export your bot to me in a DM after hiding all sensitive information, and then I can try and debug it.
s
The problem is that this doesn't happen in debug mode - I noticed this in production mode when users access it. I can export it, but this should be analyzed using the server logs.
f
I tried to test it on my end, both in the emulator and with a published version. Is this still happening for you and can you recreate it or was it a 1 time thing?
s
It happens from time to time. I see this in the bot panel - conversations. There is just an information about the bot and no content (screenshot). Looks like the code didn't work. For some time I didn't know what was going on. And suddenly today it happened to me the same as to other users. I can't replicate this because it happens from time to time. This error requires analysis of the code or server logs - real ones - to find the source of this problem. To me, it looks like an initialization problem - I've noticed that some of the conversation IDs differ from time to time. Take a look at the screenshots - you can see two conversationId that are saved when the conversation starts - they look different but I think they should be similar (like conv_01HX447859ZNS744H7KP1FKXTT). It might be a bug. https://cdn.discordapp.com/attachments/1236625820546633799/1236731554638856285/image.png?ex=66391383&is=6637c203&hm=896afdf307c394feaf0aab149e60e8099a138af2d1a8d6ba0fee6db76f19e3f3& https://cdn.discordapp.com/attachments/1236625820546633799/1236731554911228005/image.png?ex=66391384&is=6637c204&hm=9c6f09abf645c7b76fd8a399d4efddc17793b8946b05ddc20569a9cd6aff24c6&
@bumpy-butcher-41910 Because of this empty content, I lose users/customers - 1-2 per 10 conversations. This is about a 10% loss. In the logs, I can see that the conversation was started, but nothing happened. I'm trying to find a way how to use Conversation Started Trigger in case the browser blocks javascript to initiate the conversation using webchat trigger (screenshots). I don't know why, from time to time, the custom trigger doesn't work. I don't have any filters on the trigger, and I use "Always" to redirect in case the payload is not recognized. https://cdn.discordapp.com/attachments/1236625820546633799/1236735593871052820/image.png?ex=66391747&is=6637c5c7&hm=962218adf5bcfa91cc9dd9ec3ad22c83e2c2c54ca3452e328d8ea9e10567775c& https://cdn.discordapp.com/attachments/1236625820546633799/1236735594147614810/image.png?ex=66391747&is=6637c5c7&hm=d9e93e9673edd42d22c91ea5baf6eec08ef80e1273f51c414a7f932828a34f4a&
f
The first one
convo-3
is a conversation id from the emulator. The second one is from a conversation outside of the emulator
s
Oh, ok - good to know, thanks
f
s
When I enable it, I get twice the triggers - once from Conversation Started and the second from the custom trigger. It doesn't look good 😉
Therefore, it's disabled
I don't know how to make the custom one as primary and if not received within 1-2s then trigger conversation started
f
Why do you need the custom trigger?
s
I'm sending a payload - language, location, etc.
f
Ah okay
You could probably add an execute code card at the start of the Custom Trigger flow
Then save it to a variable and check that as the first thing from your Conversation Started Trigger
I am not sure if it would work, but I can build a quick example for you
s
I do that. Unfortunately it doesn't go anywhere - bot is not initiated at all, unless I/user type in something. But he doesn't know that he must type something.
It shows only the main bot information and nothing else
f
Have you tried using
userData
to parse the needed information?
Heres an example, including the bot and a JSFiddle
s
Oh, so you mean to use the conversation started with the userData, do I understand you correctly?
f
Yup
That is correct
s
Makes sense, I will change it and test - in theory should work - thanks
f
Sounds good! You are very welcome, and let me know if it works
s
Unfortunately, I can't receive the content from the page. The data is empty, or the Log card doesn't present the content. https://cdn.discordapp.com/attachments/1236625820546633799/1236774941266022482/image.png?ex=66393bec&is=6637ea6c&hm=c2ffa79a576ada175a0fc38544cab711d4edbfad5e9f4b9e9378c83618c48398&
Here is the userData and the variables I use but even the example doesn't work - I'm not sure why. https://jsfiddle.net/ysepn0z3/
I'm not sure what I'm doing wrong
f
Hey there, In your code, the userData object is being initialized with variables that all have empty or unset values. Therefore, when the userData object is passed into the init method of botpressWebChat, it contains no meaningful data. Here’s a breakdown of what’s happening: - You’ve declared a set of variables (like userLanguage, userTimeZone, etc.) and assigned them empty strings or similar placeholder values. - These variables are then used to construct the userData object. - At the time of botpressWebChat.init(), none of these variables have been assigned any actual values, so userData is populated with these empty or unset values. To resolve this issue, you need to ensure that these variables are set with actual data before they are used in the userData object. Here's how you might approach this: Here’s an example modification to set userLanguage and userTimeZone before initializing the chat: https://jsfiddle.net/hm0beq48/2/ https://cdn.discordapp.com/attachments/1236625820546633799/1237111219979157546/image.png?ex=663a751b&is=6639239b&hm=7f56cf9d63be09f4ddf3d1ae41d51a57d2565bbeaed80ef5aaa1f9f6afe5d6ee&
I haven't changed anything with the bot
9 Views