Search code examples
javascriptelectronchromiumspeech-to-textazure-cognitive-services

Bing speech API, Electron: "cu.connect is not a function"


I'm getting an error on line 510 (cu.connect(source);) of speech.1.0.0.js saying cu.connect is not a function. I'm prototyping using the Bing API inside an Electron app, so this is using Chromium. When I debug, cu is an anonymous function, and it does not have a "connect" property of any type.


Solution

  • The problem ultimately came down to using the file:// protocol inside Electron. Changing the useHttp function (line 211) to just return true fixed it.

    So, change line 211 from:

    return getValue("useHttp");

    to:

    return true;

    and things will start working. I'm still trying to figure out whether forcing Http this way is going to cause any side effects (it doesn't appear to so far).