Just getting back to Nakama - server issues

I just updated Nakama to the latest version (3.13.1) as well as updated my client library. I am currently having issues with my server side code. When attempting to join an authoritative game I get the following error:

docker-nakama-1 | {"level":"warn","ts":"2022-09-20T15:42:43.647Z","caller":"server/match_handler.go:523","msg":"Stopping match after error from match_join execution","mid":"adbc04d5-99a5-4b84-a44f-630c32dc31f6","tick":3,"error":"TypeError: Cannot assign to read only property '_getPrototypeOf' at _getPrototypeOf (index.js:70:71(11))"}

This is happening on match_join, but I can’t figure out why. Am I doing something wrong? Do I need to update something I haven’t? I’ve traced it as far as I could without finding an obvious error.

My code creates a Player object that extends a BasePlayer object the crash seems to happen when calling the BasePlayer constructor through a super() call in the Player constructor.

This was all working prior to upgrading of course.

Any suggestions?
Thanks!

Apparently this had nothing to do with Nakama (which I suspected)

I guess this was due to upgrading rollup. I ended up just forcing typescript to target es5 and that seems to have fixed my issue. Will need to debug further but it seems ok now.

Looks like I am still having trouble with the same core issue yet in a different spot:

docker-nakama-1       | {"level":"warn","ts":"2022-09-21T16:39:52.916Z","caller":"server/match_handler.go:292","msg":"Stopping match after error from match_loop execution","mid":"58f543d6-8da1-4625-a493-7db18633c63a","tick":20,"error":"TypeError: Cannot assign to read only property '_typeof' at _typeof (index.js:8259:51(16))"}

I realize this may not be Nakama related as the rollup change to es5 target seemed to help the previous error. Any ideas here?

babel.config.json needs:

{
  "presets": [
    ["@babel/preset-env", { 
      "exclude": [
        "transform-typeof-symbol"
      ]
    }]
  ],
  "plugins": []
}

That seems to have fixed this latest issue…

1 Like

Thanks for this! I’ve been pulling my hair out trying to change all the assignments of variables in some of the code…

If you get this error and apply the solution mentioned here,and the problem persists, try this this time because that’s how my problem was solved.

{
“presets”: [“@babel/preset-typescript”]
}

1 Like

or disable read-only global variables feature Heroic Labs Documentation | Configuration

This worked out better, thanks!

I ran into this issue again when I added a different module from npm. This fixed it. I had to install @babel/preset-typescript to get it to work, fyi.