question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

readConvos error: TypeError: Converting circular structure to JSON

See original GitHub issue

This error appears when I run like this: testmybot-master/samples/watson$ npm run emulatorBrowser

readConvos error: TypeError: Converting circular structure to JSON

I found which place throws error:

/samples/watson/node_modules/testmybot/src/emulator/browser/index.js

  router.route('/testcases')
    .post(function(req, res) {
      if (!req.body.header || !req.body.header.name)
        return res.json({ success: false, error: 'Name not specified' });
      if (!req.body.conversation)
        return res.json({ success: false, error: 'Conversation not specified' });

      try {
        const filename = tmb.convoReader.writeConvo(req.body, true);
        return res.json({ success: true, filename: filename });
      } catch (err) {
        console.log('writeConvo error: ' + err);
        return res.json({ success: false, error: err });
      }
    }).get(function(req, res) {
      try {
        const convos = tmb.convoReader.readConvos()
        return res.json(convos);  // <---- This line says "TypeError: Converting circular structure to JSON"
      } catch (err) {        
        console.log('readConvos error: ' + err);
        return res.json({ success: false, error: err });
      }
    });

I’ve logged convos value before throwing error, this is convos’s value:

[ Convo {
    provider: 
     ScriptingProvider {
       caps: [Object],
       compilers: [Object],
       convos: [Circular],
       utterances: {},
       match: [Function],
       scriptingEvents: [Object] },
    header: ConvoHeader { name: 'testt_1', order: 1, description: undefined },
    conversation: [ [Object], [Object], [Object], [Object] ],
    sourceTag: 'testt_1.convo.txt' },
  Convo {
    provider: 
     ScriptingProvider {
       caps: [Object],
       compilers: [Object],
       convos: [Circular],
       utterances: {},
       match: [Function],
       scriptingEvents: [Object] },
    header: ConvoHeader { name: 'testt_2', order: 2, description: undefined },
    conversation: 
     [ [Object],
       [Object],
       [Object],
       [Object],
       [Object],
       [Object],
       [Object] ],
    sourceTag: 'testt_2.convo.txt' } ]

>npm run emulator works fine, only >npm run emulatorBrowser throws above error. Browser opens http://127.0.0.1:3000/#!/testsuite but there is nothing to do there, busy loader rotates. I’m using nodejs v6.9.5, npm 3.10.10, kubuntu 16.04

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
ikr0mcommented, Apr 5, 2018

Great news! Just tried it and it generated multiple *.convo.txt and *.utterances.txt files. I’ve uploaded one pair of them. ok_input.utterances.txt ok.convo.txt I don’t know how to use them so far. I look usage deeply later from botium-cli.

0reactions
codeforequity-atcommented, Apr 11, 2018

Added the browser emulator to the botium-cli as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

12D1D06F1C6EE368DB6E8F67...
Filename: 12D1D06F1C6EE368DB6E8F67BD7E1C803F571B841450DEBCC68E4674F17D76B3.exe; Size: 26MiB (27348536 bytes); Type: peexe executable ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found