Unlock seamless workflows and faster delivery with our latest releases - Join the deep dive

Error in using microsoft-cognitiveservices-speech-sdk in Sanity resolved by installing older version

3 replies
Last updated: Aug 30, 2021
Hi, I am trying to use microsoft-cognitiveservices-speech-sdk in sanity, and after I installed sdk and added
import {SpeechSynthesizer} from "microsoft-cognitiveservices-speech-sdk";
in file with my custom action, I got an error after executing
sanity start

√ Checking configuration files...
\ Compiling...webpack built 74a7c7e7f64625131e5c in 40364ms
√ Compiling...
Failed to compile.

Error in ./node_modules/bent/src/browser.js
Module parse failed: Unexpected token (61:27)
You may need an appropriate loader to handle this file type.
|   }
|
|   _headers = new Headers({ ...(headers || {}), ..._headers })
|
|   const resp = await fetch(parsed, { method, headers: _headers, body })
 @ ./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.browser/RestMessageAdapter.js 13:0-24
 @ ./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/src/common.browser/Exports.js
 @ ./node_modules/microsoft-cognitiveservices-speech-sdk/distrib/es2015/microsoft.cognitiveservices.speech.sdk.js
 @ ./customPublishAction.js
 @ ./resolveDocumentActions.js (part:@sanity/base/document-actions/resolver)
 @ ./node_modules/@sanity/desk-tool/lib/panes/documentPane/keyboardShortcuts/documentActionShortcuts.js
 @ ./node_modules/@sanity/desk-tool/lib/panes/documentPane/keyboardShortcuts/index.js
 @ ./node_modules/@sanity/desk-tool/lib/panes/documentPane/documentPane.js
 @ ./node_modules/@sanity/desk-tool/lib/panes/documentPane/documentPaneProvider.js
 @ ./node_modules/@sanity/desk-tool/lib/panes/documentPane/index.js
 @ ./node_modules/@sanity/desk-tool/lib/panes/DeskToolPane.js
 @ ./node_modules/@sanity/desk-tool/lib/panes/index.js
 @ ./node_modules/@sanity/desk-tool/lib/tool/DeskToolPanes.js
 @ ./node_modules/@sanity/desk-tool/lib/tool/DeskTool.js
 @ ./node_modules/@sanity/desk-tool/lib/tool/index.js
 @ ./node_modules/@sanity/vision/lib/VisionTool.js (all:part:@sanity/base/tool)
 @ ./node_modules/@sanity/default-layout/lib/router.js
 @ ./node_modules/@sanity/default-layout/lib/Root.js (part:@sanity/base/root)
 @ ./node_modules/@sanity/base/lib/components/SanityRoot.js (part:@sanity/base/sanity-root)
 @ ./node_modules/@sanity/server/lib/browser/entry-dev.js
 @ multi ./node_modules/@sanity/server/lib/browser/entry-dev.js 
How to fix this?
Aug 22, 2021, 3:10 PM
Hey Oleksandr! First off, did you try cleaning your
node_modules
by
rm -rf node_modules
and reinstalling?
Aug 23, 2021, 6:59 PM
Hi, Rachel!Thanks for your help, I resolved this problem by installing an older version of azure speech SDK (in my case it was 1.13.1)
Aug 30, 2021, 1:42 PM
Glad you got it sorted out! And thanks for sharing the solution
Aug 30, 2021, 2:58 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?