deepstreamIO / deepstream.io-client-js

The Browser / Node.js Client for deepstream.io
Other
294 stars 109 forks source link

Uncaught ReferenceError: Buffer is not defined #580

Closed geohuz closed 1 year ago

geohuz commented 1 year ago

Describe the bug install the deepstreamio.client with yarn add @deepstream/client, get the following error with the new DeepstreamClient():

Uncaught ReferenceError: Buffer is not defined

jaime-ez commented 1 year ago

which client version? which platform (node, browser, react-native)?

geohuz commented 1 year ago

HI @jaime-ez, it's the newest client version with reactjs running on browser

jaime-ez commented 1 year ago

Hi, you'll have to provide an example, I can not reproduce the error. Are you using a bundler?

geohuz commented 1 year ago

Hi @jaime-ez , quote from stack overflow:

In Webpack version 5, Webpack no longer automatically polyfill's Node.js API's if they are not natively supported anymore. The browser environment does not support Buffer natively, therefore we now need to add a third party Buffer package and point Node.js to it in the Webpack config.

So I have to manually install the buffer packge then fix the issue.

jaime-ez commented 1 year ago

Oh ok, the you could install it per the instrucions for react native and thus change the main file to the already bundled one:

DEEPSTREAM_ENV=react-native npm install @deepstream/client --save

I'm gonna keep this open in order to remind me to document it

jaime-ez commented 1 year ago

Hi, this should be fixed in the latest version 7.0.1 Please reopen if problem persists