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

Added circular JSON handling to forwardToMain #2242

Merged
merged 4 commits into from
Mar 9, 2021
Merged

Conversation

tonyanziano
Copy link
Contributor

When connecting to a Direct Line Speech enabled bot, the Web Chat speech adapter object embedded in one of the redux payloads contained a circular JSON structure -- privReco property -- that was causing the JSON.stringify() call in forwardToMain.ts to fail.

This was ultimately causing the Redux action to fail, which resulted in an undefined speech adapter object being sent to Web Chat. Web Chat could not complete the connection to the DL Speech channel.


This PR adds error handling for this specific case, and will bypass forwarding the speech adapters update action over to the main process of the app. It is not needed in the main process's state store anyways.

All other errors will be thrown like normal.

As an example, here's what the error message looked like:

Converting circular structure to JSON
    --> starting at object with constructor 'p'
    |     property 'privReco' -> object with constructor 'D'
    --- property 'privRecognizer' closes the circle"

@coveralls
Copy link

coveralls commented Mar 8, 2021

Coverage Status

Coverage decreased (-0.02%) to 67.823% when pulling 6a89d4a on toanzian/speech into 860b5f2 on main.

Copy link
Contributor

@corinagum corinagum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - just one question

@tonyanziano tonyanziano merged commit e879409 into main Mar 9, 2021
@tonyanziano tonyanziano deleted the toanzian/speech branch March 9, 2021 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants