bugfix: archive error, use replacer (#2041)

## Description:

Use replacer when serializing GameRecord json

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

evan
This commit is contained in:
evanpelle
2025-09-10 07:36:42 -07:00
committed by GitHub
parent 5ffb4a41b7
commit 319508c360
2 changed files with 6 additions and 2 deletions
+2 -1
View File
@@ -7,6 +7,7 @@ import {
ID,
PartialGameRecord,
} from "../core/Schemas";
import { replacer } from "../core/Util";
import { logger } from "./Logger";
const config = getServerConfigFromServer();
@@ -25,7 +26,7 @@ export async function archive(gameRecord: GameRecord) {
const url = `${config.jwtIssuer()}/game/${gameRecord.info.gameID}`;
const response = await fetch(url, {
method: "POST",
body: JSON.stringify(gameRecord),
body: JSON.stringify(gameRecord, replacer),
headers: {
"Content-Type": "application/json",
"x-api-key": config.apiKey(),
+4 -1
View File
@@ -16,6 +16,7 @@ import {
PartialGameRecordSchema,
ServerErrorMessage,
} from "../core/Schemas";
import { replacer } from "../core/Util";
import { CreateGameInputSchema, GameInputSchema } from "../core/WorkerSchemas";
import { archive, finalizeGameRecord, readGameRecord } from "./Archive";
import { Client } from "./Client";
@@ -340,7 +341,9 @@ export async function startWorker() {
// Ignore ping
return;
} else if (clientMsg.type !== "join") {
log.warn(`Invalid message before join: ${JSON.stringify(clientMsg)}`);
log.warn(
`Invalid message before join: ${JSON.stringify(clientMsg, replacer)}`,
);
return;
}