When a message contains a question mark, the question mark is replaced with a positional binding such as $1 when stored in the events database.
To Reproduce
Steps to reproduce the behavior:
Start a botpress instance using postgres as backing
Post a message to any bot containing a question mark, such as Hello?
Read the events from the database using e.g. psql
See that the message was stored as Hello$1, as in below:
... | web | ... | {"type":"text","channel":"web","direction":"outgoing","payload":{"type":"text","workflow":{},"text":"Hello$1","markdown":true,"typing":true},"target":"b84c3cdc-8797-453c-a0a9-ebacaa4e343c","botId":"boost-eq","createdOn":"2022-07-28T15:45:56.879Z","threadId":"d74ebeca-09cd-4ad6-a2ef-718dad525620","id":"28786047122291477","preview":"Hello$2","flags":{},"messageId":"a7c5db9e-0062-410f-b57a-66a19d85d371","incomingEventId":"28784735653166018","nlu":{"entities":[],"language":"n/a","ambiguous":false,"slots":{},"intent":{"name":"none","confidence":1,"context":"global"},"intents":[],"errored":false,"includedContexts":["global"],"ms":0}}
Expected behavior
The message should be stored as entered by the user (or as created by the bot)
Environment (please complete the following information):
OS: macOS
Browser Chrome
Browser Version 103.0.5060.134
Botpress Version 12.27.0
NodeJS 12.22.12
Additional context
Note that this doesn't seem to be an issue when using sqlite - those events are stored correctly. I believe this may be an issue in event-collector.ts around line 160 and the use of knex.raw, but I'm not completely confident in that assessment. It's causing issues for us because we have a custom module which re-creates the conversation history for a user from the events table, and obviously this means we're showing incorrect messages back to the user.
Describe the bug
When a message contains a question mark, the question mark is replaced with a positional binding such as
$1
when stored in theevents
database.To Reproduce Steps to reproduce the behavior:
Hello?
psql
Hello$1
, as in below:Expected behavior
The message should be stored as entered by the user (or as created by the bot)
Environment (please complete the following information):
Additional context
Note that this doesn't seem to be an issue when using sqlite - those events are stored correctly. I believe this may be an issue in
event-collector.ts
around line 160 and the use ofknex.raw
, but I'm not completely confident in that assessment. It's causing issues for us because we have a custom module which re-creates the conversation history for a user from the events table, and obviously this means we're showing incorrect messages back to the user.