Updating nakama above 3.10.0 breaks existing code because of read only _getPrototypeOf

Hi everyone!

My existing code base (that works fine with nakama server version 3.10.0) breaks if I update the server to 3.12.0

I’m getting the following error now for a specific:
TypeError: Cannot assign to read only property '_getPrototypeOf' at _getPrototypeOf

For my setup, I’m using the typescript runtime with rollup and the following configuration:

import resolve from "@rollup/plugin-node-resolve";
import commonJS from "@rollup/plugin-commonjs";
import json from "@rollup/plugin-json";
import babel from "@rollup/plugin-babel";
import typescript from "@rollup/plugin-typescript";
import pkg from "./package.json";
import builtins from "rollup-plugin-node-builtins";
import { defineConfig } from "rollup";

const extensions = [".mjs", ".js", ".ts", ".json"];

export default defineConfig({
    input: "./src/index.ts",
    external: ["nakama-runtime"],
    plugins: [
        // Allows node_modules resolution
        // throws weird errors, uncommented for now.
        resolve({ extensions }),
        builtins({ fs: true, builtins: false }),

        // Compile TypeScript
        // Resolve CommonJS modules
        commonJS({ extensions }),

        // Transpile to ES5
            babelHelpers: "bundled",
    output: {
        file: pkg.main,

The error occurs only on one endpoint because that endpoint uses luxon (successor of moment.js) to help me handle dates/timestamps.

Anybody got a clue what I can change to mitigate that error?
Any reason why this now no longer functions as expected?


There was a change made in Nakama 3.11.0 to make JavaScript Globals read-only to reduce the memory footprint. This behaviour can be reverted by changing the Nakama js_read_only_globals value to false.

As a side, I would recommend reading through our consolidated Release Notes when planning a server upgrade as this should hopefully help you identify any changes that may cause issues ahead of time.

Please let me know if this resolves your issue.

Hi @tom

That indeed did the trick! :tada:

I actually read the release notes before, but I didn’t connect the dots after I found this issue later :smile:

Also I feel it would be really useful to include a section in the changelog about newly added config options. As without it there is no indication that the globals can actually be enabled again :slightly_smiling_face:
And there were a few times were I was wondering about new config options only to see that they don’t work and then realizing they are only available after an upgrade :sweat_smile:

But anyways, thanks for your help and have a nice day! :slight_smile:

Perfect, glad to hear you resolved the issue and thanks for the feedback. :slight_smile: