Getting ReferenceError: XMLHttpRequest is not defined

When I am trying to authenticate client using Javascript SDK I am getting the above ReferenceError: XMLHttpRequest is not defined. I can see the error is coming from nakama-js package. Can anyone please help? Given below from where the error coming from .

/home/ashik/nakama-prac-1/node_modules/@heroiclabs/nakama-js/dist/nakama-js.cjs.js:544
  const descriptor = Object.getOwnPropertyDescriptor(XMLHttpRequest.prototype, "withCredentials");
                                                     ^
ReferenceError: XMLHttpRequest is not defined

I can see the error is coming from nakama-js.cjs.js file from it’s 544th line. Can any one please help?

Hello @Shahariar_Ashik,

The error above is likely because you’re attempting to use the nakama-js sdk in Node.js, which will not work because it currently does not support it (we’re planning on adding support in the future but we can’t give a timeline at this stage).

The XMLHttpRequest object is a built-in objects in web browsers, and is not available in Node.