• 로그인
  • 장바구니에 상품이 없습니다.

home2 게시판 Next.js 게시판 aws 배포 오류 문의드립니다.

aws 배포 오류 문의드립니다.

7 글 보임 - 1 에서 7 까지 (총 7 중에서)
  • 글쓴이
  • #108988

    호루리로리
    참가자
    
    eb1
    
    eb2
    
    
    eb3
    
    aws eb 배포중 502에러가 나와서 문의드립니다.
    별다른 기능들어간거 없이 monbodb 접속후 get요청 post요청 두개정도만 있고 테스트용으로 배포중인 상황입니다
    mongodb 0.0.0.0 도 확인 하였고 로컬환경에서 모두 정상적으로 돌아가고 ajax 요청시 url입력부분도 없습니다. 2번째 사진의 오류가 계속 나오고 환경종료후 재배포 진행한것이 3번째 사진입니다.
    상태가 ok 였다가 degraded로 왔다갔다 거리고 ok 상태일때 들어가도 똑같이 502에러가 나오는데 어떤 이유 때문일가요??
    node_modules 제외한 모든 파일 전부 zip으로 묶은거고 상위 폴더가 아닌 파일 자체를 전부 묶었습니다.
    #108989

    호루리로리
    참가자
    처음 인스턴스를 잘못해서 t3.micro로 설정했다가 t2.micro로 다시 설정해서 배포도 해보았습니다
    #109036

    codingapple
    키 마스터
    로그메뉴에서 터미널 에러메세지 출력해보면 에러원인을 알 수 있습니다
    #109043

    호루리로리
    참가자
    2024/01/05 01:17:51 [error] 2850#2850: *132 connect() failed (111: Connection refused) while connecting to upstream, client: 198.235.24.13, server: , request: "GET / HTTP/1.0", upstream: "http://127.0.0.1:8080/"
    2024/01/05 01:21:28 [error] 2850#2850: *135 upstream prematurely closed connection while reading response header from upstream, client: 54.175.182.99, server: , request: "GET /dist/.git/config HTTP/1.1", upstream: "http://127.0.0.1:8080/dist/.git/config", host: "18.119.58.15"
    2024/01/05 01:31:23 [error] 2850#2850: *137 connect() failed (111: Connection refused) while connecting to upstream, client: 35.203.210.79, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8080/", host: "18.119.58.15:80"
    2024/01/05 01:33:17 [error] 2850#2850: *139 upstream prematurely closed connection while reading response header from upstream, client: 31.220.88.155, server: , request: "GET /admin/config.php HTTP/1.0", upstream: "http://127.0.0.1:8080/admin/config.php", host: "18.119.58.15"
    
    위가가 제일 최근 에러이고 인스턴스 상태를 보니 92 % of CPU is in use. 이렇게 나오기도 합니다.
    기능도 별거 없고 무한루프 돌아가거나 그런 기능도 없이 db 접속후 데이터만 가져오는 기능 뿐인데 이렇게 나오네여...
    인스턴스 문제인가 해서 지금 전부 해본게 t2.small , t2.micro , t3.micro 이렇게 3개 한번씩 설정해서 재배포 해보아도 똑같습니다..
     
    #109057

    codingapple
    키 마스터
    그거말고 터미널에러같은거 있을걸요 mongodb 접속 ip 0.0.0.0으로 해놨나 확인해봅시다
    #109658

    호루리로리
    참가자
    선생님 아직도 해결을 못했습니다 ㅠㅠ
    일단 몽고디비 0.0.0.0은 당연히 확인됐고 로그 출력해서 확인해봤을때 버전 문제인거 같아 버전 업글레이드 하고 다시 재배포 하였더니
    502에러에서 500으로 바꼈습니다. 아래는 500에러로 바뀐 후 로그입니다.
    
    Jan 10 01:20:54 ip-172-31-12-24 web[36984]: > fresh@0.1.0 start
    Jan 10 01:20:54 ip-172-31-12-24 web[36984]: > next start
    Jan 10 01:20:55 ip-172-31-12-24 web[37052]:   â–² Next.js 14.0.4
    Jan 10 01:20:55 ip-172-31-12-24 web[37052]:   - Local:        http://localhost:8080
    Jan 10 01:20:55 ip-172-31-12-24 web[37052]: ✓ Ready in 1031ms
    Jan 10 01:23:41 ip-172-31-12-24 web[37052]: ⨯ Error: Cannot find module 'next/dist\client\components\static-generation-async-storage.external.js'
    Jan 10 01:23:41 ip-172-31-12-24 web[37052]: Require stack:
    Jan 10 01:23:41 ip-172-31-12-24 web[37052]: - /var/app/current/.next/server/app/page.js
    Jan 10 01:23:41 ip-172-31-12-24 web[37052]: - /var/app/current/node_modules/next/dist/server/require.js
    Jan 10 01:23:41 ip-172-31-12-24 web[37052]: - /var/app/current/node_modules/next/dist/server/next-server.js
    Jan 10 01:23:41 ip-172-31-12-24 web[37052]: - /var/app/current/node_modules/next/dist/server/next.js
    Jan 10 01:23:41 ip-172-31-12-24 web[37052]: - /var/app/current/node_modules/next/dist/server/lib/start-server.js
    Jan 10 01:23:41 ip-172-31-12-24 web[37052]: - /var/app/current/node_modules/next/dist/cli/next-start.js
    Jan 10 01:23:41 ip-172-31-12-24 web[37052]: - /var/app/current/node_modules/next/dist/lib/commands.js
    Jan 10 01:23:41 ip-172-31-12-24 web[37052]: - /var/app/current/node_modules/next/dist/bin/next
    Jan 10 01:23:41 ip-172-31-12-24 web[37052]:    at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
    Jan 10 01:23:41 ip-172-31-12-24 web[37052]:    at /var/app/current/node_modules/next/dist/server/require-hook.js:55:36
    Jan 10 01:23:41 ip-172-31-12-24 web[37052]:    at Module._load (node:internal/modules/cjs/loader:922:27)
    Jan 10 01:23:41 ip-172-31-12-24 web[37052]:    at Module.require (node:internal/modules/cjs/loader:1143:19)
    Jan 10 01:23:41 ip-172-31-12-24 web[37052]:    at mod.require (/var/app/current/node_modules/next/dist/server/require-hook.js:65:28)
    Jan 10 01:23:41 ip-172-31-12-24 web[37052]:    at require (node:internal/modules/cjs/helpers:119:18)
    Jan 10 01:23:41 ip-172-31-12-24 web[37052]:    at 5319 (/var/app/current/.next/server/app/page.js:1:766)
    Jan 10 01:23:41 ip-172-31-12-24 web[37052]:    at t (/var/app/current/.next/server/webpack-runtime.js:1:127)
    Jan 10 01:23:41 ip-172-31-12-24 web[37052]:    at 8300 (/var/app/current/.next/server/chunks/345.js:1:77147)
    Jan 10 01:23:41 ip-172-31-12-24 web[37052]:    at t (/var/app/current/.next/server/webpack-runtime.js:1:127) {
    Jan 10 01:23:41 ip-172-31-12-24 web[37052]:  code: 'MODULE_NOT_FOUND',
    Jan 10 01:23:41 ip-172-31-12-24 web[37052]:  requireStack: [
    Jan 10 01:23:41 ip-172-31-12-24 web[37052]:    '/var/app/current/.next/server/app/page.js',
    Jan 10 01:23:41 ip-172-31-12-24 web[37052]:    '/var/app/current/node_modules/next/dist/server/require.js',
    Jan 10 01:23:41 ip-172-31-12-24 web[37052]:    '/var/app/current/node_modules/next/dist/server/next-server.js',
    Jan 10 01:23:41 ip-172-31-12-24 web[37052]:    '/var/app/current/node_modules/next/dist/server/next.js',
    Jan 10 01:23:41 ip-172-31-12-24 web[37052]:    '/var/app/current/node_modules/next/dist/server/lib/start-server.js',
    Jan 10 01:23:41 ip-172-31-12-24 web[37052]:    '/var/app/current/node_modules/next/dist/cli/next-start.js',
    Jan 10 01:23:41 ip-172-31-12-24 web[37052]:    '/var/app/current/node_modules/next/dist/lib/commands.js',
    Jan 10 01:23:41 ip-172-31-12-24 web[37052]:    '/var/app/current/node_modules/next/dist/bin/next'
    Jan 10 01:23:41 ip-172-31-12-24 web[37052]:  ]
    Jan 10 01:23:41 ip-172-31-12-24 web[37052]: }
    
    
    노드버전 문제인가 해서 노드버전 , next 버전 전부 업그레이드 하고 재배포 해보았는데 아직도 500에러 입니다.
    이전에 뜨던 502랑 cpu 97% 이런건 전부 사라졌습니다.
    #109674

    codingapple
    키 마스터
    https://stackoverflow.com/a/77627473/22444723
    "\node_modules\next\dist\build\handle-externals.js" 파일 수정하면 된다는 소리가 있습니다 
    
7 글 보임 - 1 에서 7 까지 (총 7 중에서)
  • 답변은 로그인 후 가능합니다.

About

현재 월 700명 신규수강중입니다.

  (09:00~20:00) 빠른 상담은 카톡 플러스친구 코딩애플 (링크)
  admin@codingapple.com
  이용약관
ⓒ Codingapple, 강의 예제, 영상 복제 금지
top

© Codingapple, All rights reserved. 슈퍼로켓 에듀케이션 / 서울특별시 강동구 고덕로 19길 30 / 사업자등록번호 : 212-26-14752 온라인 교육학원업 / 통신판매업신고번호 : 제 2017-서울강동-0002 호 / 개인정보관리자 : 박종흠