Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Occasional Sync input too long error response ? #525

Closed
playahater opened this issue Nov 16, 2017 · 1 comment
Closed

Occasional Sync input too long error response ? #525

playahater opened this issue Nov 16, 2017 · 1 comment

Comments

@playahater
Copy link

playahater commented Nov 16, 2017

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

@fhinkel
Copy link
Contributor

fhinkel commented Nov 8, 2018

If the issue still persists, please file it here. Thank you.

@fhinkel fhinkel closed this as completed Nov 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants