elevenlabs / elevenlabs-js

The official JavaScript (Node) library for ElevenLabs Text to Speech.
https://elevenlabs.io
MIT License
149 stars 15 forks source link

ElevenLabsError: this.readableStream.getReader is not a function #84

Closed TowhidKashem closed 2 months ago

TowhidKashem commented 3 months ago

Hi,

Just trying to run a very basic example in node but running into this error:

ElevenLabsError: this.readableStream.getReader is not a function
    at TextToSpeech.<anonymous> (/Users/redacted/Desktop/node_modules/elevenlabs/api/resources/textToSpeech/client/Client.js:125:27)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/redacted/Desktop/node_modules/elevenlabs/api/resources/textToSpeech/client/Client.js:31:58)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Non-zero exit: code 1, signal null

eleven-test.mjs:

import { ElevenLabs, ElevenLabsClient } from 'elevenlabs';

const elevenlabs = new ElevenLabsClient({
  apiKey: 'REDEACTED'
});

const audio = await elevenlabs.generate({
  text: 'the quick brown fox jumped over some lazy dog',
  model_id: 'eleven_multilingual_v2',
  voice: 'Rachel',
  language_code: 'en-US',
  output_format: ElevenLabs.OutputFormat.Mp32205032,
  optimize_streaming_latency: ElevenLabs.OptimizeStreamingLatency.Zero
});

console.log({ audio });

running it from the terminal like:

node eleven-test.mjs

RohinBhargava commented 3 months ago

Hi Towhid! In my tests, the language_code parameter ended up being an issue that led to an error.

I see this in the source code: https://github.com/elevenlabs/elevenlabs-js/blob/da57b8790e985de26ab27ed6acab0c9f854aaa97/src/api/resources/textToSpeech/client/requests/TextToSpeechRequest.ts#L37C9-L37C207

Can you please try to either change the model being used or remove the parameter and see if the API works? I understand this is suboptimal UX, and if that's the fix, I will make sure that we track better error messages from the client, and have better examples!

TowhidKashem commented 2 months ago

Hi Towhid! In my tests, the language_code parameter ended up being an issue that led to an error.

I see this in the source code: https://github.com/elevenlabs/elevenlabs-js/blob/da57b8790e985de26ab27ed6acab0c9f854aaa97/src/api/resources/textToSpeech/client/requests/TextToSpeechRequest.ts#L37C9-L37C207

Can you please try to either change the model being used or remove the parameter and see if the API works? I understand this is suboptimal UX, and if that's the fix, I will make sure that we track better error messages from the client, and have better examples!

I ended up using the rest api, but before that had tried various things including removing those additional optional options and had the same issue. Anyway if it's not happening for you consider it closed.