Super Kawaii Cute Cat Kaoani
본문 바로가기
🏃‍♀️ 대외활동/UMC 7기 - Node.js

[UMC 7th Server] 9주차 트러블 슈팅

by wonee1 2024. 11. 25.
728x90

🌩 트러블 슈팅


NO 1

 

Environment variables loaded from .env
Prisma schema loaded from prisma\schema.prisma
Error: 
EPERM: operation not permitted, unlink 'D:\umc-week5\node_modules\.prisma\client\query_engine-windows.dll.node'

[nodemon] app crashed - waiting for file changes before starting...


문제

👉
해당 오류는`query_engine-windows.dll.node`파일에 대한 권한 문제가 발생했거나, 파일이 다른 프로세스에서 사용 중인 상태로 인해 삭제되지 않아서 발생한 것 

 

해결
👉  

Node.js 및 관련 프로세스를 종료하기 

- 파일이 사용 중일 가능성이 있으므로, 모든 Node.js 관련 프로세스를 종료합니다:
    1. Windows 작업 관리자를 열기 (`Ctrl + Shift + Esc)
    2. Node.js 관련 프로세스를 모두 종료.
    3. 다시 npm start`** 명령 실행.


 

NO 2

 

 

이슈

👉

  "resultType": "FAIL",
  "error": {
    "errorCode": "unknown",
    "reason": "Cannot read properties of undefined (reading 'findFirst')",
    "data": null
  },
  "success": null
}

문제

👉 이 오류 메시지는 Prisma 클라이언트를 사용하려는 코드에서 findFirst 메서드를 호출하려 했지만, 해당 객체나 메서드가 정의되지 않았기 때문에 발생합니다.

 

 

해결

👉 Prisma Client 초기화 확인, Prisma Client 재생성

 

 

 

NO 3

 

이슈

👉

file:///D:/umc-week5/src/auth.config.js:7
import { prisma } from "./db.config.js";     
         ^^^^^^

SyntaxError: Identifier 'prisma' has already been declared
    at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:169:18)
    at callTranslator (node:internal/modules/esm/loader:272:14)
    at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:278:30)

Node.js v20.15.0
[nodemon] app crashed - waiting for file changes before starting...

문제

👉 prisma 중복 선언:

  • auth.config.js에서 import { prisma } from "./db.config.js";로 임포트했으나, index.js에서도 같은 객체를 임포트하여 중복 선언이 발생한 것!

.

해결

👉 prisma 객체를 한 번만 정의하고 필요한 파일에서 재사용하도록 설정

 

 

NO 4

 

이슈

👉

Server is running on port 3000
set(): PrismaClientKnownRequestError: 
Invalid this.prisma[this.sessionModelName].update() invocation in
D:\\umc-week5\\node_modules\\@quixo3\\prisma-session-store\\dist\\lib\\prisma-session-store.js:536:81

  533 case 3:
  534     _a.trys.push([3, 8, , 9]);
  535     if (!(existingSession !== null)) return [3 /*break*/, 5];
→ 536     return [4 /*yield*/, this.prisma[this.sessionModelName].update(
The provided value for the column is too long for the column's type. Column: data
PrismaClientKnownRequestError: 
Invalid this.prisma[this.sessionModelName].update() invocation in
D:\\umc-week5\\node_modules\\@quixo3\\prisma-session-store\\dist\\lib\\prisma-session-store.js:536:81

  533 case 3:
  534     _a.trys.push([3, 8, , 9]);
  535     if (!(existingSession !== null)) return [3 /*break*/, 5];
→ 536     return [4 /*yield*/, this.prisma[this.sessionModelName].update(
The provided value for the column is too long for the column's type. Column: data
    at Mn.handleRequestError (D:\\umc-week5\\node_modules\\@prisma\\client\\runtime\\library.js:121:7753)
    at Mn.handleAndLogRequestError (D:\\umc-week5\\node_modules\\@prisma\\client\\runtime\\library.js:121:7061)
    at Mn.request (D:\\umc-week5\\node_modules\\@prisma\\client\\runtime\\library.js:121:6745)  
    at async l (D:\\umc-week5\\node_modules\\@prisma\\client\\runtime\\library.js:130:9633)     

 

 

문제

👉 해당 오류는 **@quixo3/prisma-session-store**에서 세션 데이터를 데이터베이스에 저장하려고 할 때, data 열의 값이 데이터베이스에서 정의된 최대 길이를 초과했기 때문에 발생

.

해결

👉 data 열의 데이터 타입 수정하여서 해결했습니다.

 

model Session {
  id        String   @id
  sid       String   @unique
  data      String   @db.Text
  expiresAt DateTime @map("expires_at")

  @@map("session")
}

 

 

728x90