nextjs14 배포 에러 (aws amplify 배포)

김철준·2024년 3월 17일
1

next.js

목록 보기
4/10

이번에는 aws amplify를 통해 배포를 해보았다.

이번에도 역시 서버 컴포넌트를 사용하는 페이지에서 에러가 발생했다.

해당 서버 컴포넌트에서는 prisma에서 rds에 연결하여 데이터를 sql을 통해 가져오고 있다.

클라우드 와치에서 에러를 확인해보니 다음과 같았다.


2024-03-18T01:30:48.398+09:00	PrismaClientInitializationError:

2024-03-18T01:30:48.398+09:00	Invalid `prisma.country.findMany()` invocation:

2024-03-18T01:30:48.398+09:00	Prisma Client could not locate the Query Engine for runtime "rhel-openssl-1.0.x".

2024-03-18T01:30:48.398+09:00	This happened because Prisma Client was generated for "rhel-openssl-3.0.x", but the actual deployment required "rhel-openssl-1.0.x".

2024-03-18T01:30:48.398+09:00	Add "rhel-openssl-1.0.x" to `binaryTargets` in the "schema.prisma" file and run `prisma generate` after saving it:

2024-03-18T01:30:48.398+09:00	generator client {

2024-03-18T01:30:48.398+09:00	provider = "prisma-client-js"

2024-03-18T01:30:48.398+09:00	binaryTargets = ["native", "rhel-openssl-1.0.x"]

2024-03-18T01:30:48.398+09:00	}

2024-03-18T01:30:48.398+09:00	The following locations have been searched:

2024-03-18T01:30:48.398+09:00	/var/task/node_modules/.prisma/client

2024-03-18T01:30:48.398+09:00	/var/task/node_modules/@prisma/client

2024-03-18T01:30:48.398+09:00	/codebuild/output/src1765139759/src/APP_Exchange_Language/node_modules/@prisma/client

2024-03-18T01:30:48.398+09:00	/tmp/prisma-engines

2024-03-18T01:30:48.398+09:00	at _n.handleRequestError (/var/task/node_modules/@prisma/client/runtime/library.js:123:7154)

2024-03-18T01:30:48.398+09:00	at _n.handleAndLogRequestError (/var/task/node_modules/@prisma/client/runtime/library.js:123:6188)

2024-03-18T01:30:48.398+09:00	at _n.request (/var/task/node_modules/@prisma/client/runtime/library.js:123:5896)

2024-03-18T01:30:48.398+09:00	at async l (/var/task/node_modules/@prisma/client/runtime/library.js:128:10871)

2024-03-18T01:30:48.398+09:00	at async i (/var/task/.next/server/app/signup/start2/page.js:1:6672) {

2024-03-18T01:30:48.398+09:00	clientVersion: '5.10.2',

2024-03-18T01:30:48.398+09:00	errorCode: undefined

2024-03-18T01:30:48.398+09:00	}

주목해야할 에러 메시지는 다음이다.

2024-03-18T01:30:48.398+09:00 Prisma Client could not locate the Query Engine for runtime "rhel-openssl-1.0.x".
2024-03-18T01:30:48.398+09:00 This happened because Prisma Client was generated for "rhel-openssl-3.0.x", but the actual deployment required "rhel-openssl-1.0.x".
2024-03-18T01:30:48.398+09:00 Add "rhel-openssl-1.0.x" to binaryTargets in the "schema.prisma" file and run prisma generate after saving it:
2024-03-18T01:30:48.398+09:00 generator client {
2024-03-18T01:30:48.398+09:00 provider = "prisma-client-js"
2024-03-18T01:30:48.398+09:00 binaryTargets = ["native", "rhel-openssl-1.0.x"]

prisma.schema에서 binaryTargets :rhel-openssl-1.0.x 이렇게 추가해달라고 하는 것 같다.

prisma.schema에 다음과 같이 추가해줬다.

generator client {
  provider      = "prisma-client-js"
  binaryTargets = ["native", "rhel-openssl-1.0.x"]
}

위와 같이 추가해보고 다시 배포해보니 해당 서버 컴포넌트 페이지에 성공적으로 들어가졌다.

profile
FE DEVELOPER

1개의 댓글

comment-user-thumbnail
2024년 3월 19일

생명의 은인입니다. 감사합니다

답글 달기