Circular Structure Error in Botpress While Capturi...
# 🤝help
g
Context: I am developing a chatbot using Botpress, with a flow to capture email addresses from Firestore. The flow steps are as follows: 1. Retrieve emails from Firestore in
workflow.auth
. 2. Extract email addresses into
workflow.emails
. 3. Check if
user.emailToCheck
exists in
workflow.emails
. 4. If it exists, perform actions such as generating a random code and updating Firestore. I have a card in Botpress that asks for the email address using an information capture card. However, when attempting to capture the email, I receive the following error:
Copy code
TypeError: Converting circular structure to JSON
    --> starting at object with constructor 'ClientRequest'
    |     property 'socket' -> object with constructor 'TLSSocket'
    --- property '_httpMessage' closes the circle
    at JSON.stringify (<anonymous>)
    at save (/var/task/customer_code.js:1132:6122)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Promise.all (index 7)
    at async saveAllStates (/var/task/customer_code.js:1132:6272)
    at async saveState (/var/task/customer_code.js:1132:8820)
    at async /var/task/customer_code.js:1153:13755
    at async #e (/var/task/customer_code.js:1153:13308)
    at async /var/task/customer_code.js:1153:11996)
    at async /var/task/customer_code.js:314:170
The error indicates an attempt to convert a circular structure to JSON, which is not allowed. The error message shows the following cycle: - It starts with an object constructed by
ClientRequest
. - This object has a
socket
property, which is an object constructed by
TLSSocket
. - The
TLSSocket
object has a
_httpMessage
property that refers back to the original
ClientRequest
object, closing the circle. In summary, attempting to call
JSON.stringify
on this object traps the process in a loop due to these circular references. This error occurs when running the chatbot in webchat; it does not happen in the Botpress Studio chat. https://cdn.discordapp.com/attachments/1240317298930352178/1240317299445989456/Captura_de_pantalla_2024-05-14_172149.png?ex=66461f00&is=6644cd80&hm=7e1a16f9ef8524bd155b6d80a2544741b28f7f6881ff92f8c1ead4dcd5852971&
b
Me too same problem...
32 Views