Skip to content

Occasional Sync input too long error response ? #525

@playahater

Description

@playahater

Hi,

i'm having issues with nodejs client.
I'm using node v8.8.1 and "@google-cloud/speech": "^0.11.0"

Sometimes I get:

debug: Error: Sync input too long. For audio longer than 1 min use LongRunningRecognize with a 'uri' parameter.
    at /srv/http/career/node_modules/grpc/src/node/src/client.js:554:15

For the same file, the request 3s later returns success:

debug:  wpm=197

I'm using this method to transcribe an audio:

    private encoding: string = 'FLAC';
    private sampleRateHertz: number = 16000;
    private languageCode: string = 'en-US';

    private async recognize(buffer: Buffer): Promise<any> {
        try {
            const client = new speech.v1.SpeechClient({
                keyFilename: `${process.env.PWD}/${config.speechToText.service_account_json}`,
            });  
            return await client.recognize({
                config: {
                    languageCode: this.languageCode,
                    sampleRateHertz: this.sampleRateHertz,
                    encoding: this.encoding,
                },   
                audio: {
                    content: buffer.toString('base64'),
                },   
            });  
        } catch (e) {
            throw e;
        }    
    } 

I have a retry delay and total count of max 3 retries.
There is no pattern. Sometimes i get success on second request [ retry ], sometimes all three retires fail.
Files are correctly encoded and not longer than 60s. Which above debug messages prove.
I'm trying to figure out the issue for a while now and can't reproduce it or pinpoint the reason. It happens on some occasions. Google console states that around 40% of requests are failing in my case.
Any clue why may this be happening?

Thanx in advance,
Best

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions