deepgram / deepgram-js-sdk

Official JavaScript SDK for Deepgram's automated speech recognition APIs.
https://developers.deepgram.com
MIT License
127 stars 45 forks source link

ReferenceError: Blob is not defined #218

Closed musubipapi closed 6 months ago

musubipapi commented 6 months ago

What is the current behavior?

When I try to pass in non-string data into deepgram.send I receive the following error:

/Users/musubi/Desktop/projects/AugmentedLabs/archer-be-node/node_modules/@deepgram/sdk/src/packages/LiveClient.ts:99 } else if ((data as any) instanceof Blob) { ^ ReferenceError: Blob is not defined at LiveClient.send (/Users/musubi/Desktop/projects/AugmentedLabs/archer-be-node/node_modules/@deepgram/sdk/src/packages/LiveClient.ts:99:43) at /Users/musubi/Desktop/projects/AugmentedLabs/archer-be-node/src/server.ts:85:34 at Generator.next (<anonymous>) at /Users/musubi/Desktop/projects/AugmentedLabs/archer-be-node/src/server.ts:8:71 at new Promise (<anonymous>) at __awaiter (/Users/musubi/Desktop/projects/AugmentedLabs/archer-be-node/src/server.ts:4:12) at WebSocket.<anonymous> (/Users/musubi/Desktop/projects/AugmentedLabs/archer-be-node/src/server.ts:62:44) at WebSocket.emit (node:events:390:28) at WebSocket.emit (node:domain:475:12) at Receiver.receiverOnMessage (/Users/musubi/Desktop/projects/AugmentedLabs/archer-be-node/node_modules/ws/lib/websocket.js:1178:20)

What's happening that seems wrong?

It should allow you to pass into buffer like data for nodejs

Steps to reproduce

To make it faster to diagnose the root problem. Tell us how can we reproduce the bug.

Expected behavior

What would you expect to happen when following the steps above?

Please tell us about your environment

We want to make sure the problem isn't specific to your operating system or programming language.

Other information

Anything else we should know? (e.g. detailed explanation, stack-traces, related issues, suggestions how to fix, links for us to have context, eg. stack overflow, codepen, etc)

lukeocodes commented 6 months ago

Were you using the SDK in a client side or server side app? What is the environment this was running in?

Blob has been native since Node 18, and is available all in modern browsers.

musubipapi commented 6 months ago

thanks @lukeocodes i had a severely outdate node environment -- fixed with the changes!

lukeocodes commented 6 months ago

You're welcome! Hope the demo helps!