fix crash log, uncomment code which may lead to crash

This commit is contained in:
einhornimmond 2025-10-14 11:08:04 +02:00
parent c0a60f4ca6
commit b7f34ace84
3 changed files with 7 additions and 6 deletions

View File

@ -159,11 +159,11 @@ export class AuthenticationResolver {
const authComPublicKey = new Ed25519PublicKey(authCom.publicKey)
methodLogger.debug('authCom.publicKey', authComPublicKey.asHex())
methodLogger.debug('args.publicKey', argsPublicKey.asHex())
/*if (!authComPublicKey.isSame(argsPublicKey)) {
if (!authComPublicKey.isSame(argsPublicKey)) {
throw new Error(
`corrupt authentication call detected, oneTimeCode: ${authArgs.oneTimeCode} doesn't belong to caller: ${argsPublicKey.asHex()}`
)
}*/
}
const communityUuid = uuidv4Schema.safeParse(authArgs.uuid)
if (!communityUuid.success) {
throw new Error(
@ -174,7 +174,7 @@ export class AuthenticationResolver {
// need to use query builder, loading from db, changing and save lead to server crash with this error:
// TypeError [ERR_INVALID_ARG_TYPE]: The "otherBuffer" argument must be of type Buffer or Uint8Array. Received an instance of Object
// seems to be a typeorm problem with Buffer, even if I give a freshly created Buffer for public_key
await DbCommunity.createQueryBuilder()
/*await DbCommunity.createQueryBuilder()
.update(DbCommunity)
.set({
communityUuid: communityUuid.data,
@ -183,7 +183,8 @@ export class AuthenticationResolver {
.where({ id: authCom.id })
.execute()
methodLogger.debug('update authCom.uuid successfully')
*/
methodLogger.debug('skipped community update')
const homeComB = await getHomeCommunity()
if (homeComB?.communityUuid) {
const responseArgs = new AuthenticationResponseJwtPayloadType(args.handshakeID,homeComB.communityUuid)

View File

@ -35,7 +35,7 @@ async function main() {
} else {
const endTime = new Date()
const duration = endTime.getTime() - startTime.getTime()
printServerCrashAsciiArt(`reason: ${reason}`, `duration: ${duration}ms`, '')
printServerCrashAsciiArt('Server Crash', `reason: ${reason}`, `duration: ${duration}ms`)
logger.error(error)
}
})

View File

@ -46,6 +46,6 @@ export function onShutdown(shutdownHandler: (reason: ShutdownReason, error?: Err
export function printServerCrashAsciiArt(msg1: string, msg2: string, msg3: string) {
console.error(colors.redBright(` /\\_/\\ ${msg1}`))
console.error(colors.redBright(`( x.x ) ${msg2}`))
console.error(colors.redBright(`> < ${msg3}`))
console.error(colors.redBright(` > < ${msg3}`))
console.error(colors.redBright(''))
}