I am trying to setup a server side js runtime function for nakama-game server running on a eks fargate cluster. i have setup the js-entrypoint and added the test.js to data/modules by adding it as a configmap and then mounting it at data/modules in the nakama image. the funciton is kept extremely simple it looks like this
kind: ConfigMap
apiVersion: v1
metadata:
name: runtime-config
data:
test.js: |
function sayHi (ctx, logger, nk, payload) {
logger.debug("Function called");
return "hi";
};
but on the nakama pods i am getting error {"level":"info","ts":"2023-04-13T13:59:03.313Z","caller":"server/runtime_javascript.go:612","msg":"Initialising JavaScript runtime provider","path":"data/modules","entrypoint":"./test.js"} {"level":"error","ts":"2023-04-13T13:59:03.315Z","caller":"server/runtime_javascript.go:2289","msg":"InitModule function not found. Function must be defined at top level.","module":"test.js"} {"level":"error","ts":"2023-04-13T13:59:03.315Z","caller":"server/runtime_javascript.go:1654","msg":"Failed to eval JavaScript modules.","error":"InitModule function not found."} {"level":"error","ts":"2023-04-13T13:59:03.315Z","caller":"server/runtime.go:639","msg":"Error initialising JavaScript runtime provider","error":"InitModule function not found."} {"level":"fatal","ts":"2023-04-13T13:59:03.315Z","caller":"main.go:158","msg":"Failed initializing runtime modules","error":"InitModule function not found."}
i tried adding a blank InitModule function to test.js but i am confused what should be done inside this function.