Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ast.Property is *ast.PropertyShort, not *ast.PropertyKeye #1202

Open
CristianoDigitalmoka opened this issue Apr 15, 2024 · 1 comment
Open
Assignees

Comments

@CristianoDigitalmoka
Copy link

I am having an issue when I update the nakama image from 3.17.1 to an updated version (checked with every version).

When I compose with Docker the Nakama Container goes down after a few seconds reporting this error:

2024-04-15 08:42:05 panic: interface conversion: ast.Property is *ast.PropertyShort, not *ast.PropertyKeyed [recovered]
2024-04-15 08:42:05 panic: interface conversion: ast.Property is *ast.PropertyShort, not *ast.PropertyKeyed [recovered]
2024-04-15 08:42:05 panic: interface conversion: ast.Property is *ast.PropertyShort, not *ast.PropertyKeyed [recovered]
2024-04-15 08:42:05 panic: interface conversion: ast.Property is *ast.PropertyShort, not *ast.PropertyKeyed
2024-04-15 08:42:05
2024-04-15 08:42:05 goroutine 1 [running]:
2024-04-15 08:42:05 github.com/dop251/goja.(*Runtime).runWrapped.func1()
2024-04-15 08:42:05 github.com/dop251/goja@v0.0.0-20240220182346-e401ed450204/runtime.go:2442 +0x171
2024-04-15 08:42:05 panic({0x1e11bc0?, 0xc0007669c0?})
2024-04-15 08:42:05 runtime/panic.go:914 +0x21f
2024-04-15 08:42:05 github.com/dop251/goja.(*vm).handleThrow(0xc000116fc0, {0x1e11bc0, 0xc0007669c0})
2024-04-15 08:42:05 github.com/dop251/goja@v0.0.0-20240220182346-e401ed450204/vm.go:788 +0x425
2024-04-15 08:42:05 github.com/dop251/goja.(*vm).try.func1()
2024-04-15 08:42:05 github.com/dop251/goja@v0.0.0-20240220182346-e401ed450204/vm.go:807 +0x3f
2024-04-15 08:42:05 panic({0x1e11bc0?, 0xc0007669c0?})
2024-04-15 08:42:05 {"level":"info","ts":"2024-04-15T06:42:05.606Z","caller":"migrate/migrate.go:226","msg":"Successfully applied migration","count":0}
2024-04-15 08:42:05 {"level":"info","ts":"2024-04-15T06:42:05.617Z","caller":"server/config.go:90","msg":"Successfully loaded config file","path":"/nakama/data/local.yml"}
2024-04-15 08:42:05 runtime/panic.go:914 +0x21f
2024-04-15 08:42:05 github.com/dop251/goja.(*vm).handleThrow(0xc000116fc0, {0x1e11bc0, 0xc0007669c0})
2024-04-15 08:42:05 github.com/dop251/goja@v0.0.0-20240220182346-e401ed450204/vm.go:788 +0x425
2024-04-15 08:42:05 github.com/dop251/goja.(*vm).runTryInner.func1()
2024-04-15 08:42:05 github.com/dop251/goja@v0.0.0-20240220182346-e401ed450204/vm.go:830 +0x3f
2024-04-15 08:42:05 panic({0x1e11bc0?, 0xc0007669c0?})
2024-04-15 08:42:05 runtime/panic.go:914 +0x21f
2024-04-15 08:42:05 github.com/heroiclabs/nakama/v3/server.(*RuntimeJavascriptInitModule).getMatchHookFnIdentifier(0xc000288fc0, 0xc0005bf3e8?, 0x7fe900742ce8?, {0xc0000e8d5b, 0xb}, {0xc00054009a, 0x2}, {0x200b370, 0x9})
2024-04-15 08:42:05 github.com/heroiclabs/nakama/v3/server/runtime_javascript_init.go:1619 +0x7c9
2024-04-15 08:42:05 github.com/heroiclabs/nakama/v3/server.(*RuntimeJavascriptInitModule).extractMatchFnKey(0x27d2268?, 0xc000766930?, {0xc00054009a, 0x2}, {0x200b370, 0x9})
2024-04-15 08:42:05 github.com/heroiclabs/nakama/v3/server/runtime_javascript_init.go:1570 +0x8a
2024-04-15 08:42:05 github.com/heroiclabs/nakama/v3/server.(*RuntimeJavascriptInitModule).mappings.(*RuntimeJavascriptInitModule).registerMatch.func12({{0x27d2268, 0xc0007319b0}, {0xc0000011c0, 0x2, 0x4}})
2024-04-15 08:42:05 github.com/heroiclabs/nakama/v3/server/runtime_javascript_init.go:1456 +0x198
2024-04-15 08:42:05 github.com/dop251/goja.(*nativeFuncObject).vmCall(0xc00047a820, 0xc000116fc0, 0x2)
2024-04-15 08:42:05 github.com/dop251/goja@v0.0.0-20240220182346-e401ed450204/func.go:563 +0x186
2024-04-15 08:42:05 github.com/dop251/goja.call.exec(0xb?, 0xc000116fc0)
2024-04-15 08:42:05 github.com/dop251/goja@v0.0.0-20240220182346-e401ed450204/vm.go:3375 +0x66
2024-04-15 08:42:05 github.com/dop251/goja.(*vm).run(0xc000116fc0)
2024-04-15 08:42:05 github.com/dop251/goja@v0.0.0-20240220182346-e401ed450204/vm.go:582 +0x5b
2024-04-15 08:42:05 github.com/dop251/goja.(*vm).runTryInner(0xc000116fc0?)
2024-04-15 08:42:05 github.com/dop251/goja@v0.0.0-20240220182346-e401ed450204/vm.go:834 +0x65
2024-04-15 08:42:05 github.com/dop251/goja.(*baseJsFuncObject).__call(0xc000000a80, {0xc000129bc0?, 0x4, 0xc0005bf800?}, {0x0?, 0x0}, {0x27d2a38?, 0x34b7600?})
2024-04-15 08:42:05 github.com/dop251/goja@v0.0.0-20240220182346-e401ed450204/func.go:426 +0x70f
2024-04-15 08:42:05 github.com/dop251/goja.(*baseJsFuncObject).call(...)
2024-04-15 08:42:05 github.com/dop251/goja@v0.0.0-20240220182346-e401ed450204/func.go:442
2024-04-15 08:42:05 github.com/dop251/goja.(*baseJsFuncObject).call(0x27d2268?, {{0x27d2a38, 0x34b7600}, {0xc000129bc0, 0x4, 0x4}}, {0x0?, 0x0?})
2024-04-15 08:42:05 github.com/dop251/goja@v0.0.0-20240220182346-e401ed450204/func.go:450 +0x76
2024-04-15 08:42:05 github.com/dop251/goja.(*baseJsFuncObject).Call(...)
2024-04-15 08:42:05 github.com/dop251/goja@v0.0.0-20240220182346-e401ed450204/func.go:382
2024-04-15 08:42:05 github.com/dop251/goja.AssertFunction.func1.1()
2024-04-15 08:42:05 github.com/dop251/goja@v0.0.0-20240220182346-e401ed450204/runtime.go:2402 +0x71
2024-04-15 08:42:05 github.com/dop251/goja.(*vm).try(0xc000116fc0, 0xc0005bf9d8)
2024-04-15 08:42:05 github.com/dop251/goja@v0.0.0-20240220182346-e401ed450204/vm.go:811 +0x25b
2024-04-15 08:42:05 github.com/dop251/goja.(*Runtime).runWrapped(0xc000481c00, 0x7fe900f58508?)
2024-04-15 08:42:05 github.com/dop251/goja@v0.0.0-20240220182346-e401ed450204/runtime.go:2446 +0x71
2024-04-15 08:42:05 github.com/dop251/goja.AssertFunction.func1({0x27d2a38?, 0x34b7600?}, {0xc000129bc0?, 0x27a3ec0?, 0x6?})
2024-04-15 08:42:05 github.com/dop251/goja@v0.0.0-20240220182346-e401ed450204/runtime.go:2401 +0x8c
2024-04-15 08:42:05 github.com/heroiclabs/nakama/v3/server.evalRuntimeModules(0xc000140500, 0xc000544200, 0xc000456e40, 0xc0000a0960, {0x27bf668, 0xc00022cf20}, {0x27c1748?, 0xc000043900}, 0x27d09b0?, 0xc000453580, ...)
2024-04-15 08:42:05 github.com/heroiclabs/nakama/v3/server/runtime_javascript.go:2399 +0x795
2024-04-15 08:42:05 github.com/heroiclabs/nakama/v3/server.NewRuntimeProviderJS({
, _}, _, _, _, _, , {, _}, {0x27a3ec0, ...}, ...)
2024-04-15 08:42:05 github.com/heroiclabs/nakama/v3/server/runtime_javascript.go:705 +0x11db
2024-04-15 08:42:05 github.com/heroiclabs/nakama/v3/server.NewRuntime({0x27be058, _}, _, _, _, _, , {, _}, {0x27a3ec0, ...}, ...)
2024-04-15 08:42:05 github.com/heroiclabs/nakama/v3/server/runtime.go:657 +0xf5e
2024-04-15 08:42:05 main.main()
2024-04-15 08:42:05 main.go:164 +0x1a5e

These are the relevant files for the Typescript project

{
"files": [
"./src/main.ts",
"./src/match_handler.ts",
"./src/testFunctions.ts",
"./src/interfaces.ts",
"./src/enums.ts",
"./src/consts.ts"
],
"compilerOptions": {
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. /
"esModuleInterop": true, /
Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. /
"forceConsistentCasingInFileNames": true, /
Ensure that casing is correct in imports. /
"strict": true, /
Enable all strict type-checking options. /
"skipLibCheck": true, /
Skip type checking all .d.ts files. */
"outFile": "./build/index.js",
"typeRoots": [
"./node_modules"
]
}
}

version: '3'
services:
cockroachdb:
image: cockroachdb/cockroach:latest-v23.1
command: start-single-node --insecure --store=attrs=ssd,path=/var/lib/cockroach/
restart: "no"
volumes:
- data:/var/lib/cockroach
expose:
- "8080"
- "26257"
ports:
- "26257:26257"
- "8080:8080"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health?ready=1"]
interval: 3s
timeout: 3s
retries: 5
nakama:
image: registry.heroiclabs.com/heroiclabs/nakama:3.21.1
entrypoint:
- "/bin/sh"
- "-ecx"
- >
/nakama/nakama migrate up --database.address root@cockroachdb:26257 &&
exec /nakama/nakama --name nakama5 --config /nakama/data/local.yml --database.address root@cockroachdb:26257 --logger.level ERROR --session.token_expiry_sec 7200 --metrics.prometheus_port 9100
restart: "no"
links:
- "cockroachdb:db"
depends_on:
cockroachdb:
condition: service_healthy
prometheus:
condition: service_started
volumes:
- /C/Work/Digitalmoka/nakama-bur2/data:/nakama/data
expose:
- "7349"
- "7350"
- "7351"
- "9100"
ports:
- "7349:7349"
- "7350:7350"
- "7351:7351"
healthcheck:
test: ["CMD", "/nakama/nakama", "healthcheck"]
interval: 10s
timeout: 5s
retries: 5
prometheus:
image: prom/prometheus
entrypoint: /bin/sh -c
command: |
'sh -s < ./prometheus.yml <<EON
global:
scrape_interval: 15s
evaluation_interval: 15s

  scrape_configs:
    - job_name: prometheus
      static_configs:
      - targets: ['localhost:9090']

    - job_name: nakama
      metrics_path: /
      static_configs:
      - targets: ['nakama:9100']
  EON
  prometheus --config.file=./prometheus.yml
  EOF'
ports:
  - '9090:9090'

volumes:
data:

const rpcIdHealthCheck = 'HealthCheck';

function InitModule(ctx: nkruntime.Context, logger: nkruntime.Logger, nk: nkruntime.Nakama, initializer: nkruntime.Initializer) {

initializer.registerRpc(rpcIdHealthCheck, rpcHealthcheck);

initializer.registerMatch('match', {
    matchInit,
    matchJoinAttempt,
    matchJoin,
    matchLeave,
    matchLoop,
    matchTerminate,
    matchSignal
});

}

const matchInit : nkruntime.MatchInitFunction = function (ctx: nkruntime.Context, logger: nkruntime.Logger, nk: nkruntime.Nakama, params: {[key: string]: string}): {state: nkruntime.MatchState, tickRate: number, label: string} {
logger.debug('Lobby match created');

return {
    state: { Debug: true },
    tickRate: 10,
    label: 'wow'
};

};

const matchJoin : nkruntime.MatchJoinFunction = function (ctx: nkruntime.Context, logger: nkruntime.Logger, nk: nkruntime.Nakama, dispatcher: nkruntime.MatchDispatcher, tick: number, state: nkruntime.MatchState, presences: nkruntime.Presence[]) : { state: nkruntime.MatchState } | null {
presences.forEach(function (presence) {
state.presences[presence.userId] = presence;
logger.debug('%q joined Lobby match', presence.userId);
});

return {
    state
};

}

const matchJoinAttempt : nkruntime.MatchJoinAttemptFunction = function (ctx: nkruntime.Context, logger: nkruntime.Logger, nk: nkruntime.Nakama, dispatcher: nkruntime.MatchDispatcher, tick: number, state: nkruntime.MatchState, presence: nkruntime.Presence, metadata: {[key: string]: any }) : {state: nkruntime.MatchState, accept: boolean, rejectMessage?: string | undefined } | null {
logger.debug('%q attempted to join Lobby match', ctx.userId);

return {
    state,
    accept: true
};

}

const matchLeave : nkruntime.MatchLeaveFunction = function (ctx: nkruntime.Context, logger: nkruntime.Logger, nk: nkruntime.Nakama, dispatcher: nkruntime.MatchDispatcher, tick: number, state: nkruntime.MatchState, presences: nkruntime.Presence[]) : { state: nkruntime.MatchState } | null {
presences.forEach(function (presence) {
state.presences[presence.userId] = presence;
logger.debug('%q left Lobby match', presence.userId);
});

return {
    state
};

}

const matchLoop : nkruntime.MatchLoopFunction = function (ctx: nkruntime.Context, logger: nkruntime.Logger, nk: nkruntime.Nakama, dispatcher: nkruntime.MatchDispatcher, tick: number, state: nkruntime.MatchState, messages: nkruntime.MatchMessage[]) : { state: nkruntime.MatchState} | null {
logger.debug('Lobby match loop executed');

return {
    state
};

}

const matchSignal : nkruntime.MatchSignalFunction = function (ctx: nkruntime.Context, logger: nkruntime.Logger, nk: nkruntime.Nakama, dispatcher: nkruntime.MatchDispatcher, tick: number, state: nkruntime.MatchState, data: string) : { state: nkruntime.MatchState, data?: string } | null {
logger.debug('Lobby match signal received: ' + data);

return {
    state,
    data: "Lobby match signal received: " + data
};

}

const matchTerminate : nkruntime.MatchTerminateFunction = function (ctx: nkruntime.Context, logger: nkruntime.Logger, nk: nkruntime.Nakama, dispatcher: nkruntime.MatchDispatcher, tick: number, state: nkruntime.MatchState, graceSeconds: number) : { state: nkruntime.MatchState} | null {
logger.debug('Lobby match terminated');

return {
    state
};

}

If i Remove the the match registration in the InitModule function i do not have the error anymore

Copy link

linear bot commented Apr 15, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants