Vonage / vonage-node-sdk

Vonage API client for Node.js. API support for SMS, Voice, Text-to-Speech, Numbers, Verify (2FA) and more.
Apache License 2.0
375 stars 178 forks source link

[Bug]: voice.playTTS: TypeError: instanceof called on an object with an invalid prototype property. #927

Closed tapz closed 1 month ago

tapz commented 2 months ago

Node Version

20.x

Platform

Docker Container

SDK Version

3.13.0

Code Sample

await vonage.voice.playTTS(
      callId,
      {
        action: 'talk',
        'Hello',
        'fi-FI',
        style: 0,
        loop: 1,
        premium: true
      }
    );

Expected Behavior

Talks to the call

Actual Behavior

TypeError: instanceof called on an object with an invalid prototype property.
    at <anonymous> (/home/node_modules/@vonage/server-client/dist/client.js:225:20)
    at processTicksAndRejections (:12:39)
manchuck commented 1 month ago

@tapz I bet there was a bad build of this version While I was out. v3.14 should have this resolved

tapz commented 6 days ago

@manchuck Still seeing this with 3.14.2

tapz commented 6 days ago
TypeError: instanceof called on an object with an invalid prototype property.
    at <anonymous> (/home/bun/node_modules/@vonage/server-client/dist/client.js:225:34)
    at processTicksAndRejections (:12:39)
manchuck commented 5 days ago

@tapz You are missing the properties for the text and language. The call should look like:

await vonage.voice.playTTS(
  callId,
  {
    action: 'talk',
    text: 'Hello',
    language: 'fi-FI',
    style: 0,
    loop: 1,
    premium: true
  }
);
tapz commented 5 days ago

@manchuck Actually my sample is incorrect. I give the values like this:

{
  action: 'talk',
  text,
  language,
  style: 0,
  loop: 1,
  premium: true
}
tapz commented 5 days ago

But I'll change it to send a request directly to the api without the library. Maybe get some error code.