Shuta-syd / 42-ft_transcendence

This project is about creating a website for the mighty Pong contest
1 stars 1 forks source link

【SQL】front側でUTF8エンコーディングに従っているのかを確認してからAPIを叩く #263

Closed Shuta-syd closed 1 year ago

Shuta-syd commented 1 year ago
          以下いくつか、バックエンドでエラーが出てた!意図した挙動であれば無視してほしい

protectルームを二つとも同じパスワードで作った時に、backend側で以下のエラーが発生する

[Nest] 338  - 04/12/2023, 1:49:51 PM   ERROR [ExceptionsHandler] 
Invalid `.create()` invocation in
/backend/src/chat/chat.service.ts:47:8

  44   hashedPassword = hash.toString() + '.' + salt;
  45 }
  46 const room = this.prisma.chatRoom
→ 47   .create(
Error occurred during query execution:
ConnectorError(ConnectorError { user_facing_error: None, kind: QueryError(Error { kind: Db, cause: Some(DbError { severity: "ERROR", parsed_severity: Some(Error), code: SqlState(E22021), message: "invalid byte sequence for encoding \"UTF8\": 0x00", detail: None, hint: None, position: None, where_: Some("unnamed portal parameter $3"), schema: None, table: None, column: None, datatype: None, constraint: None, file: Some("mbutils.c"), line: Some(1665), routine: Some("report_invalid_encoding") }) }), transient: false })
Error: 
Invalid `.create()` invocation in
/backend/src/chat/chat.service.ts:47:8

  44   hashedPassword = hash.toString() + '.' + salt;
  45 }
  46 const room = this.prisma.chatRoom
→ 47   .create(
Error occurred during query execution:
ConnectorError(ConnectorError { user_facing_error: None, kind: QueryError(Error { kind: Db, cause: Some(DbError { severity: "ERROR", parsed_severity: Some(Error), code: SqlState(E22021), message: "invalid byte sequence for encoding \"UTF8\": 0x00", detail: None, hint: None, position: None, where_: Some("unnamed portal parameter $3"), schema: None, table: None, column: None, datatype: None, constraint: None, file: Some("mbutils.c"), line: Some(1665), routine: Some("report_invalid_encoding") }) }), transient: false })
    at Kr.handleRequestError (/backend/node_modules/@prisma/client/src/runtime/RequestHandler.ts:220:13)
    at Kr.handleAndLogRequestError (/backend/node_modules/@prisma/client/src/runtime/RequestHandler.ts:173:12)
    at Kr.request (/backend/node_modules/@prisma/client/src/runtime/RequestHandler.ts:163:12)
    at PrismaService._request (/backend/node_modules/@prisma/client/src/runtime/getPrismaClient.ts:1036:14)
    at /backend/node_modules/@nestjs/core/router/router-execution-context.js:46:28
    at /backend/node_modules/@nestjs/core/router/router-proxy.js:9:17

ブラウザで以下のポップアップが出る スクリーンショット 2023-04-12 23 19 36

_Originally posted by @public-jun in https://github.com/Shuta-syd/42-ft_transcendence/pull/245#pullrequestreview-1381439514_

Shuta-syd commented 1 year ago

送信文字を監視するためのミドルウェアを実装することで、毎回確認できるはず