microsoft / microsoft/BotFramework-WebChat
Error thrown and uncaught while speaking " " (empty space) on Safari using Cognitive Services
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 1.8k
- Forks
- 1.6k
- Avg merge
- 22h 58m
- Merged PRs (30d)
- 2
Description
(Reported internally via Teams on behalf of customer)
Screenshots

Version
Possibly 4.12.0
Describe the bug
When using Cognitive Services to speak on an activity with speak field of an empty space " ", AudioContext.decodeAudioData will throw an exception, because the TTS-ed wavedata is empty (0 bytes in length, instead of MP3).
Thus, AudioContext.decodeAudioData(ArrayBuffer.from([])) would throw an exception.
This only happens in Safari because Safari is using an older signature of AudioContext.decodeAudioData, a.k.a. callback signature.

Due to a bug on how we handle the callback signature, we throw an exception of null. It propagate up through here:

Since error is null, accessing error.stack will trigger an exception, which is uncaught.
Steps to reproduce
- On Safari, speak to a bot that will result in an activity with
speakfield set to" "(empty space)
Expected behavior
It should not narrate anything.
Additional context
[Bug]
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the AudioContext.decodeAudioData callback handling described in the issue, then trace how the null error reaches error.stack. Reproduce on Safari with an activity whose speak field is " "; done means it produces no narration and does not throw an uncaught exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100