inflearn logo
강의

講義

知識共有

フォローして学習するノード、リアクトシリーズ - Reddit Site Creation(NextJS)

ec2 배포시 500 에러가 해결되지 않습니다

855

작성자 없음

投稿した質問数 0

0

스크린샷 2022-09-25 오전 3.25.56.png스크린샷 2022-09-25 오전 3.27.17.png스크린샷 2022-09-25 오전 3.27.28.png

강의 자료를 통해 docker-compose.yml 파일을 수정하고 server/Dockerfile과 client/Dockerfile을 다음과 같이 추가해줬습니다. 이후에 로컬에서 docker-compose up을 실행하게 되면

스크린샷 2022-09-25 오전 3.28.37.png다음과 같은 에러가 발생합니다. docker-compose.yml과 server/Dockerfile, client/Dockerfile을 추가하기 이전까지는 로컬에서는 실행하는 데에 있어서 전혀 문제가 없었습니다.

스크린샷 2022-09-25 오전 9.49.19.pngec2 상에서 sudo docker-compose up 을 실행하면 다음과 같은 에러가 발생합니다.

스크린샷 2022-09-25 오전 3.29.01.png그리고 docker-compose.yml과 server/Dockerfile, client/Dockerfile을 추가하여 ec2 상에서 실행했을 때에 계속적으로 500에러가 발생합니다. 어느 부분이 문제이고 어떻게 수정해야 할지 감이 잘 오지 않아서 질문드립니다.

nodejs typescript docker postgresql react Next.js 클론코딩

回答 2

0

tlsbamtol3467

imageclient/Dockerfile server/Dockerfile docker-compose.yml 파일 모두 강의자료와 동일하게 한 후 sudo docker-compose up 을 하게 되면 다음과 같은 에러가 발생합니다.

저장공간 부족 오류로 보여 레포지토리를 삭제하고 다시 git clone하여 프로젝트를 생성하여 해결했습니다. sudo docker-compose up을 실행할 경우

reddit-client is up-to-date

reddit-postgress is up-to-date

Starting reddit-server ... done

Attaching to reddit-client, reddit-postgress, reddit-server

reddit-client |

reddit-client | > client@0.1.0 start:prod

reddit-client | > env-cmd -f .env.production next start

reddit-client |

reddit-client | ready - started server on 0.0.0.0:3000, url: http://localhost:3000

reddit-client | info - Loaded env from /usr/src/app/.env.production

reddit-client | npm ERR! path /usr/src/app

reddit-client | npm ERR! command failed

reddit-client | npm ERR! signal SIGTERM

reddit-client | npm ERR! command sh /tmp/startprod-76075211.sh

reddit-client |

reddit-client | npm ERR! A complete log of this run can be found in:

reddit-client | npm ERR! /root/.npm/_logs/2022-09-25T06_44_41_787Z-debug-0.log

reddit-client |

reddit-client | > client@0.1.0 start:prod

reddit-client | > env-cmd -f .env.production next start

reddit-client |

reddit-client | ready - started server on 0.0.0.0:3000, url: http://localhost:3000

reddit-client | info - Loaded env from /usr/src/app/.env.production

reddit-client | npm ERR! path /usr/src/app

reddit-client | npm ERR! command failed

reddit-client | npm ERR! signal SIGTERM

reddit-client | npm ERR! command sh /tmp/startprod-eb67da0d.sh

reddit-client |

reddit-client | npm ERR! A complete log of this run can be found in:

reddit-client | npm ERR! /root/.npm/_logs/2022-09-25T07_00_11_720Z-debug-0.log

reddit-client |

reddit-client | > client@0.1.0 start:prod

reddit-client | > env-cmd -f .env.production next start

reddit-client |

reddit-client | ready - started server on 0.0.0.0:3000, url: http://localhost:3000

reddit-client | info - Loaded env from /usr/src/app/.env.production

reddit-client | npm ERR! path /usr/src/app

reddit-client | npm ERR! command failed

reddit-client | npm ERR! signal SIGTERM

reddit-client | npm ERR! command sh /tmp/startprod-5c6ae273.sh

reddit-client |

reddit-client | npm ERR! A complete log of this run can be found in:

reddit-client | npm ERR! /root/.npm/_logs/2022-09-25T07_22_53_603Z-debug-0.log

reddit-client |

reddit-client | > client@0.1.0 start:prod

reddit-client | > env-cmd -f .env.production next start

reddit-client |

reddit-client | ready - started server on 0.0.0.0:3000, url: http://localhost:3000

reddit-client | info - Loaded env from /usr/src/app/.env.production

reddit-client | npm ERR! path /usr/src/app

reddit-client | npm ERR! command failed

reddit-client | npm ERR! signal SIGTERM

reddit-client | npm ERR! command sh /tmp/startprod-b4542fa5.sh

reddit-client |

reddit-client | npm ERR! A complete log of this run can be found in:

reddit-client | npm ERR! /root/.npm/_logs/2022-09-25T07_41_03_766Z-debug-0.log

reddit-client |

reddit-client | > client@0.1.0 start:prod

reddit-client | > env-cmd -f .env.production next start

reddit-client |

reddit-client | ready - started server on 0.0.0.0:3000, url: http://localhost:3000

reddit-client | info - Loaded env from /usr/src/app/.env.production

reddit-client | npm ERR! path /usr/src/app

reddit-client | npm ERR! command failed

reddit-client | npm ERR! signal SIGTERM

reddit-client | npm ERR! command sh /tmp/startprod-abd308d1.sh

reddit-client |

reddit-client | npm ERR! A complete log of this run can be found in:

reddit-client | npm ERR! /root/.npm/_logs/2022-09-25T07_41_11_506Z-debug-0.log

reddit-client |

reddit-client | > client@0.1.0 start:prod

reddit-client | > env-cmd -f .env.production next start

reddit-client |

reddit-client | ready - started server on 0.0.0.0:3000, url: http://localhost:3000

reddit-client | info - Loaded env from /usr/src/app/.env.production

client에서 다음과 같은 에러메시지가 발생합니다. 이외에 server와 postgres는 올바르게 실행됩니다.

pm2 restart all을 실행하여 reddit-server와 reddit-client를 모두 실행하였을 때에 홈화면은 올바르게 나타나지만 이번에는 아래와 같은 에러가 발생합니다.

image저장

0

tlsbamtol3467

imageclient/Dockerfile 에서 RUN npm run build 부분을 RUN npm run build:prod 로 변경하여 실행했더니 본 글의 5번째 사진과 같은 오류는 해결된 듯 합니다. 그러나 해당 상황에서 계속 업데이트가 되지 않고 있고 ec2 주소로는 접근이 안되고 있습니다.

toJson을 추가하면 [sub].tsx에서 sub를 받아오지 못합니다.

0

122

2

쿠키 저장이 되지 않습니다.

0

226

1

AxiosError {message: 'Request failed with status code 401/500', name: 'AxiosError', code: 'ERR_BAD_RESPONSE', (2)

0

581

1

AxiosError {message: 'Request failed with status code 401/500', name: 'AxiosError', code: 'ERR_BAD_RESPONSE',

0

651

1

overload 에러

0

170

1

docker compose up 오류

0

209

1

부록) remark 강의 중 parmas 오류

0

140

1

3000번은 잘 들어가지는데 80번은 안됩니다.

1

295

0

커뮤니티를 올리고 난 후 404 page

0

209

1

tailwind css 문제인지, className 에 적용한 css가 적용되지 않아요.

0

1043

2

tsx 수정 시 마다 빌드 후 서버 시작 해야하나요?

0

654

2

useState 쳤을 때 자동완성 되는 단축키 무엇인가요? extention 인가요?

0

805

2

리액트 서버 npm run dev 와 npm run build 후 npm start 의 차이

0

4614

2

data 폴더가 생성되지 않아요.

0

527

1

docker-compose up 오류

0

814

1

회원 가입 페이지 기능 생성(3) 중 에러

0

380

2

Entity에 toJSON 코드 입력 후 404 에러

0

252

1

context에서 useEffect 선언 부분 질문 있어요.

0

295

1

src 폴더구조

0

511

2

서버 실행 시 에러 관련하여 답변받고 1차 조치했는데 여전하여서 질문 남깁니다

0

298

1

엔티티 모두 작성 후 서버 실행 시 에러가 발생합니다

0

313

1

회원가입 누르면 404에러가 뜹니다 ;-;

1

424

1

nextjs버젼에 대해서 질문드립니다.

0

373

1

<npm run dev>시 -61 에러가 나타납니다!

0

357

1