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

Error: Cannot find module 'tls' #35

Open
yuripourre opened this issue May 5, 2024 · 6 comments
Open

Error: Cannot find module 'tls' #35

yuripourre opened this issue May 5, 2024 · 6 comments

Comments

@yuripourre
Copy link

yuripourre commented May 5, 2024

Hello, I am following the steps in the documentation.

I am trying to add PlayHT to a project using next.js and webpack 5 but I am getting this error when I tried to call the listVoices method.

I get this error:

Error: Cannot find module 'tls'
...
 ⚠ ./node_modules/playht/dist/esm/index.js
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

I tried this config but it didn't work:

const nextConfig = {
    webpack: (config) => {
        config.resolve.fallback = { tls: false };
        return config;
    },
};
export default nextConfig;

Do you guys have any ideas what I am doing wrong?

Edit:

I just found this link from someone with the same problem
https://stackoverflow.com/questions/77830195/playht-integration-with-nextjs

@ttanida
Copy link

ttanida commented May 6, 2024

I have the same problem.
The playHT node sdk doesn't seem to work with next.js.

Other people have the same problem, see: #32 (comment)

I have tried a lot of different things, but nothing has worked so far.

I am looking into elevenlabs API now, since they also seem to support input text and output audio streaming.

@yuripourre
Copy link
Author

@ttanida I end up implementing all the calls using axios. I could successfully get the list of voices (V1) but apparently the text to speech endpoint doesn't work with a free account anymore.

As per: https://docs.play.ht/discuss/65e4b810845339000fd46959

It's frustrating because I would like to test it before paying for it.

@ttanida
Copy link

ttanida commented May 6, 2024

@yuripourre, you could try the Hacker plan, I think it is a reasonable price for trying out the API (https://play.ht/pricing/).

The problem with using axios for me is that, if I see correctly, I can't do input text streaming that way (only output audio streaming), since I have to send the whole text in the call. So I could just use the openAI TTS API instead, which also supports audio streaming (and I found the openAI voices to be better than playht).

Also, there is a 25 RPM rate limit on the API endpoint, which would be too low for my use case.

@srelbo
Copy link

srelbo commented May 7, 2024

@AbdelhamidGamal Can you please take a look at this one? Thanks!

@yuripourre
Copy link
Author

The problem with using axios for me is that, if I see correctly, I can't do input text streaming that way (only output audio streaming).

That's right, it doesn't support stream. But for my use case is good enough.

@OrkhanGG
Copy link

Solved:
https://stackoverflow.com/questions/77830195/playht-integration-with-nextjs/78667405#78667405

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

4 participants