Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

convo.repeat() triggering error message #1673

Closed
akshaykonjier opened this issue May 28, 2019 · 4 comments
Closed

convo.repeat() triggering error message #1673

akshaykonjier opened this issue May 28, 2019 · 4 comments
Assignees
Labels
Milestone

Comments

@akshaykonjier
Copy link

Are you sure this is an issue with the Botkit core module?

I was running into issues with the convo.repeat() function. It wasn't working on certain questions and was working on others.

What are you trying to achieve or the steps to reproduce?

I get it on random questions and have tried numerous tests to figure out what is causing it but cannot determine the issue. I'm getting an error on conversation.js on line 498 indicating that step.result.match doesn't exist. I noticed that occasionally step.result is an object instead of a string and that is where it is having the issue. I outputted the result to show this.

conversation.js in lib

image

Result in console

image

Context:

  • Botkit version: 4
  • Messaging Platform: WebSocket
  • Node version: 10.15.1
  • Os:Windows
  • Any other relevant information:
@Peter-Barrett
Copy link

I am having this issue too. For me it's happening after I begin a dialog based on the response of a question. I'm not too sure at what stage the actual error is happening though because it seems to randomly happen a couple of seconds after the question is answered.

conversation.addQuestion({
      text: ['I can help you with one of the following:'],
      channelData: {
        quick_replies: [{
          content_type: 'text',
          title: 'foo',
          payload: 'bar'
        }],
      },
    }, [{
      handler: async (response: string, convo: BotkitDialogWrapper, bot: BotWorker): Promise<any> => {
        await bot.beginDialog(response);
     }
    }], 'chosenOption', actionName);

@benbrown benbrown self-assigned this Jul 22, 2019
@benbrown
Copy link
Contributor

benbrown commented Jul 22, 2019

I have a patch that will stop this from erroring, but I am struggling to find the root cause.

Can either of you send me more information about the full structure of your dialog?

@benbrown benbrown added the bug label Jul 22, 2019
@c4ndybar
Copy link

I'm having the same issue. However, I'm getting the error TypeError: Converting circular structure to JSON. This is because step.result is an object with a circular JSON structure.

Here is a simple BotkitConversation dialog that will produce this error. Please let me know if there's something wrong with my code, but I believe it's valid.

To reproduce...

  1. Start the conversation by triggering the event.
  2. provide a name when prompted
  3. type in a bad name (i.e. 'asdf') to trigger the fallback that will call convo.repeat().

This should trigger a circular json error.

const {BotkitConversation} = require('botkit')

module.exports = function(controller) {
  const botConvo = new BotkitConversation('testConvo', controller)

  botConvo.ask({
    text: ['what is your name?'],
  }, [
    {
      default: true,
      handler: async (answer, convo, bot) => {
        await bot.say(`hi ${answer}`)
      },
    },
  ], {key: 'name'})

  botConvo.ask({
      text: ['what is your last name'],
    }
    , [
      {
        pattern: 'smith',
        handler: async (answer, convo, bot) => {
          await bot.say('I like the name smith')
        },
      },
      {
        default: true,
        handler: async (answer, convo, bot) => {
          await bot.say('name not recognized, say another name')

          await convo.repeat()
        },
      },
    ], {key: 'last-name'})


  controller.addDialog(botConvo)

  controller.on('some-event', async (bot, message) => {
    await bot.beginDialog('testConvo')
  })
}

@etiennellipse
Copy link
Contributor

@c4ndybar I believe this is a different issue; I am having it too. I will open an issue for this specific case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants