#The base URL provided does not begin with http, https, ws, or wss and will default to https as stand

1 messages · Page 1 of 1 (latest)

velvet bane
#

I am getting this error in node js. Below is the code I am trying to execute

function createStream(msg, roomId, room) {

console.log("yha hu bhai 1")

const deepgram = createClient("86a44f8b878c89fb519e7415dec769974ada82dc" );
console.log("yha hu bhai 2")
const connection = deepgram.listen.live({
  model: "nova-2",
  smart_format: true,
  encoding: "linear16",
  sample_rate: 8000,
  channels: 1,
});
console.log("yha hu bhai 3")

room.recognizeStream = connection ;

connection.on(LiveTranscriptionEvents.Open, () => {
  console.log("yha hu bhai 4")
  connection.on(LiveTranscriptionEvents.Close, () => {
    console.log("Connection closed.");
  });

  connection.on(LiveTranscriptionEvents.Transcript, (transcription) => {
    if(!room.isAiSpeaking){
      room.isAiSpeaking = true;
      room.lastActivity = Date.now();
      console.log("TEXT : " + Date.now());

      //textToSpeechRespond(getRandomElement() , roomId, true);

      respondBack(transcription , roomId, room);
    }
    else{
      console.log(transcription , " ignored" ) ;
    }
    console.dir(transcription, { depth: null });
  });
});

}

error logs are :
yha hu bhai 1
The base URL provided does not begin with http, https, ws, or wss and will default to https as standard.
yha hu bhai 2
The base URL provided does not begin with http, https, ws, or wss and will default to https as standard.
yha hu bhai 3

smoky jewelBOT
#

Thanks for asking your question. Please be sure to reply with as much detail as possible so we can assist you efficiently. Such as:

  • Provide the request_id if you've a question about a transcription response.
  • The options you used or the api.deepgram.com URL you sent your request to, including parameters.
  • Any code snippets you can include.
  • Any audio you can include, or if you can't share it here please email it to us at [email protected] and provide a link to this thread.
brisk vale
#

Hi, this is a known bug and a fix is currently in review

#

It's only a warning, and won't prevent your app from working

velvet bane
#

Now getting
Error in Call Handle DeepgramError: Could not send. Connection not open.
at LiveClient.send (/Users/umeshkumar/Work/SupportGPT/no-support-trilio/node_modules/@deepgram/sdk/dist/main/packages/LiveClient.js:95:19)
at handleCall (/Users/umeshkumar/Work/SupportGPT/no-support-trilio/websocket.js:37:30)
at WebSocket.incoming (/Users/umeshkumar/Work/SupportGPT/no-support-trilio/index.js:31:14)
at WebSocket.emit (node:events:519:28)
at Receiver.receiverOnMessage (/Users/umeshkumar/Work/SupportGPT/no-support-trilio/node_modules/ws/lib/websocket.js:1068:20)
at Receiver.emit (node:events:519:28)
at Receiver.dataMessage (/Users/umeshkumar/Work/SupportGPT/no-support-trilio/node_modules/ws/lib/receiver.js:517:14)
at Receiver.getData (/Users/umeshkumar/Work/SupportGPT/no-support-trilio/node_modules/ws/lib/receiver.js:435:17)
at Receiver.startLoop (/Users/umeshkumar/Work/SupportGPT/no-support-trilio/node_modules/ws/lib/receiver.js:143:22)
at Receiver._write (/Users/umeshkumar/Work/SupportGPT/no-support-trilio/node_modules/ws/lib/receiver.js:78:10) {
__dgError: true
}

#

This is my code below
function handleCall(message, room, roomId){
const msg = JSON.parse(message);
if(room){
switch (msg.event) {
case "connected":
console.log(A new call has connected.);
break;
case "start":
console.log("yha hu bhai 1")

    const deepgram = createClient(deepgramApiKey);
    console.log("yha hu bhai 2")
    const connection = deepgram.listen.live({
      model: "nova-2",
      smart_format: true,
      encoding: "linear16",
      sample_rate: 8000,
      channels: 1,
    });
    console.log("yha hu bhai 3")

    room.recognizeStream = connection ;
  
    connection.on(LiveTranscriptionEvents.Open, () => {
      console.log("yha hu bhai 4")
      connection.on(LiveTranscriptionEvents.Close, () => {
        console.log("Connection closed.");
      });

      connection.on(LiveTranscriptionEvents.Transcript, (transcription) => {
        if(!room.isAiSpeaking){
          room.isAiSpeaking = true;
          room.lastActivity = Date.now();
          console.log("TEXT : " + Date.now());

          //textToSpeechRespond(getRandomElement() , roomId, true);

          respondBack(transcription , roomId, room);
        }
        else{
          console.log(transcription , " ignored" ) ;
        }
        console.dir(transcription, { depth: null });
      });
    });
    console.log(`sub end bhai`);
    break;
  case "media":
    // Write Media Packets to the recognize stream

    // we can put room.lastActivity = Date.now();  here also then desolve room after 5 mins even 
    const buffer = Buffer.from(msg.media.payload, 'base64');
    room.recognizeStream.send(buffer);
    // room.recognizeStream.write({ audio: buffer });
    break;
  case "stop":
    console.log(`Call Has Ended`);
    break;
}
}
return room;

}

#

@brisk vale can you please help in this also

brisk vale
flat sinew
#

Hi, I have the same problem. How can I place the transcription listener inside the open listener, if I create "connection" in createRecognitionStream function when I get a new connection to my websocket, and then write to the connection when I get media to my websocket?