From a729caa458aefc65aa4c49e1290aa8c618fc7ec0 Mon Sep 17 00:00:00 2001 From: Hongbo Wu Date: Thu, 1 Dec 2022 11:42:36 +0800 Subject: [PATCH] Return status=500 if no audio data returned by synthesis api --- packages/text-to-speech/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/text-to-speech/src/index.ts b/packages/text-to-speech/src/index.ts index 5953478b3..849d784a9 100644 --- a/packages/text-to-speech/src/index.ts +++ b/packages/text-to-speech/src/index.ts @@ -322,7 +322,7 @@ export const textToSpeechStreamingHandler = Sentry.GCPFunction.wrapHttpFunction( } // synthesize text to speech if cache miss const { audioData, speechMarks } = await synthesizeTextToSpeech(input) - if (!audioData) { + if (!audioData || audioData.length === 0) { return res.status(500).send({ errorCode: 'SYNTHESIZER_ERROR' }) }