grammyjs / conversations

Conversational interfaces for grammY.
https://grammy.dev/plugins/conversations
MIT License
48 stars 17 forks source link

TypeError: Cannot read properties of undefined (reading 'length') #103

Closed A1tura closed 5 months ago

A1tura commented 5 months ago

I get that error when use conversation.wait(): TypeError: Cannot read properties of undefined (reading 'length')

A1tura commented 5 months ago

Full log:

TypeError: Cannot read properties of undefined (reading 'length')
    at ConversationControls.ctx.conversation.enter (/home/xxx/xxx/xxx/xxx/xxx/node_modules/@grammyjs/conversations/out/conversation.js:357:46)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
KnorpelSenf commented 5 months ago

Can you clear your session data and try again?

algorifer commented 5 months ago

@KnorpelSenf Hi, I have the same problem. I cleaned the session, but the problem still appears.

error: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'length')
                if (session.conversation[id].length === 0) {
                                             ^
    at ConversationControls.ctx.conversation.enter (https://deno.land/x/grammy_conversations@v1.2.0/conversation.ts:595:46)
    at eventLoopTick (ext:core/01_core.js:168:7)
    at async ConversationControls.ctx.conversation.enter (https://deno.land/x/grammy_conversations@v1.2.0/conversation.ts:576:17)
KnorpelSenf commented 5 months ago

Ah. You just forgot to use await when entering the conversation.

algorifer commented 5 months ago

Ah. You just forgot to use await when entering the conversation.

Yes, it worked for me. Thank you!

KnorpelSenf commented 5 months ago

You're welcome :)