valheim-ecs-fargate-cdk
valheim-ecs-fargate-cdk copied to clipboard
serverstatus and serverstartstop API Gateway Lambda fails
There seems to be some slight misconfiguration for the updownstatus API. The API responds with 500 and the Lambda logs show that the handler is not found:
{
"errorType": "Runtime.HandlerNotFound",
"errorMessage": "index.handler is undefined or not exported",
"stack": [
"Runtime.HandlerNotFound: index.handler is undefined or not exported",
" at UserFunction.js.module.exports.load (file:///var/runtime/index.mjs:1038:15)",
" at async start (file:///var/runtime/index.mjs:1200:23)",
" at async file:///var/runtime/index.mjs:1206:1"
]
}
Both endpoints are affected.
I'll take a look at this, but it'll be the earliest tomorrow.
Wondering if it doesn't like this recent change for some reason: https://github.com/rileydakota/valheim-ecs-fargate-cdk/blob/61bf2bb3db9207cd633a02969dc45522a9319b01/resources/serverstatus.ts#L38
Although it appears to still be exported here: https://github.com/rileydakota/valheim-ecs-fargate-cdk/blob/61bf2bb3db9207cd633a02969dc45522a9319b01/resources/serverstatus.ts#L53
The original: https://github.com/rileydakota/valheim-ecs-fargate-cdk/blob/72bee852ae6dcd19b674b9daa7197f59cabd861c/resources/serverstatus.ts#L29
I should have some time to take a look tonight as well
My initial tests, it looks like reverting this fixes the issue. I've still got some work to figure out how to use this API properly; it's late here, so maybe I can finish testing another day.
OK, didn't leave this. The fix is substitute the const handler [...]
lines with:
exports.handler = async (event: APIGatewayEvent, context: Context) => {
However, the startstop
endpoint doesn't seem to actually change the desire count of the Fargate task. I should probably create a new issue for this though.
Minimal change fix in PR #33