Errors running tests

Hi!

I have this year-old Nakama Typescript project. When I try to run tests, I am getting always the same error.

Nakama version: heroiclabs/nakama:3.12.0
Node: v20.2.0
Npm: 9.6.6
Yarn: 1.22.19

When I run the tests I am getting this error every time:

$npx jest mytest

`
rpcTest › Test1

TypeError: Dictionary: cocos-ignore is not an accepted type. Expected one of omit, same-origin, include.

  12 |   const client = new Client('defaultkey', '127.0.0.1', '7350', useSSL);
  13 |   return {
> 14 |     session: await client.authenticateDevice(deviceId, create, deviceId),
     |                           ^
  15 |     client: client,
  16 |   };
  17 | };

  at node_modules/@heroiclabs/nakama-js/dist/nakama-js.cjs.js:717:34
  at NakamaApi.authenticateDevice (node_modules/@heroiclabs/nakama-js/dist/nakama-js.cjs.js:717:7)
  at Client.authenticateDevice (node_modules/@heroiclabs/nakama-js/dist/nakama-js.cjs.js:3269:27)
  at __fixtures__/nakama-client.ts:14:27
  at step (__fixtures__/nakama-client.ts:33:23)
  at Object.next (__fixtures__/nakama-client.ts:14:53)
  at __fixtures__/nakama-client.ts:8:71
  at Object.<anonymous>.__awaiter (__fixtures__/nakama-client.ts:4:12)
  at authenticate (__fixtures__/nakama-client.ts:4:18)

`

Code

import { Client, Session } from ‘@heroiclabs/nakama-js’;

export const authenticate = async (
device?: string,
): Promise<{
session: Session;
client: Client;
}> => {
const deviceId = device ?? test-device-${Date.now()};
const useSSL = false; // Enable if server is run with an SSL certificate.
const create = true;
const client = new Client(‘defaultkey’, ‘127.0.0.1’, ‘7350’, useSSL);
const session = await client.authenticateDevice(deviceId, create, deviceId);
return {
session: session,
client: client,
};
};

If I add a try/catch on await client.authenticateDevice(deviceId, create, deviceId);
I get this:

● Console

console.log
  TypeError: Dictionary: cocos-ignore is not an accepted type. Expected one of omit, same-origin, include.
      at Object.fetch (node:internal/deps/undici/undici:11522:11)

  at __fixtures__/nakama-client.ts:17:15

Hi @matiasvillanueva,

What are the contents of the fixture defined there?

We have this guide on testing if you’re interested.

Hi @flavio!

The fixture has the code I pasted below. I just establish a connection and start a session.
I think there is an issue with Nakama JS lib and the latest version of node.