Tools icon indicating copy to clipboard operation
Tools copied to clipboard

agora-token: Buffer is not defined

Open iztokf opened this issue 1 year ago • 1 comments

Hi,

for development purposes I am trying to generate token on client-side based on node package 'agora-token'. RTC (RtcTokenBuilder.buildTokenWithUid) code sample returning:

Uncaught ReferenceError: Buffer is not defined at is_uuid (AccessToken2.js:197:23)

regardless of the changes I make. I get same result even if I try to run code from agora-token/sample.js.

Slowly but surely it driving me nuts :) Am i missing something or it's just broken package/dependencies?

Thanks for help!

iztokf avatar Apr 04 '23 13:04 iztokf

@iztokf Buffer is a default library provided by node.js it's not natively available on web browser. to use it in client side you will need to add an extra dependency try looking into this thread https://stackoverflow.com/questions/56237161/how-can-i-use-node-js-buffer-library-in-client-side-javascript

plutoless avatar Apr 05 '23 03:04 plutoless