grammyjs/conversations

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

Closed this issue · 6 comments

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

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)

Can you clear your session data and try again?

@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)

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

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

Yes, it worked for me. Thank you!

You're welcome :)