inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

[리뉴얼] React로 NodeBird SNS 만들기

도메인 연결하기

프론트 서버가 에러 때문에 실행이 안돼요

204

huhu

작성한 질문수 11

0

탄력적 아이피로 접속했는데 계속 로딩 중이다가

An unexpected error has occurred 라고 뜨네요.

아래가 에러 로그입니다.

/root/.pm2/logs/npm-error.log last 15 lines:

0|npm      |     at processTicksAndRejections (internal/process/task_queues.js:95:5)

0|npm      | The above error occurred in task loadPosts

0|npm      |     created by takeLatest(LOAD_POSTS_REQUEST, loadPosts)

0|npm      |     created by watchLoadPosts

0|npm      |     created by postSaga

0|npm      |     created by rootSaga

0|npm      | Tasks cancelled due to error:

0|npm      | userSaga

0|npm      | TypeError: Cannot read property 'data' of undefined

0|npm      |     at loadPosts (/home/ubuntu/react_nodebird/front/.next/server/pages/_app.js:356:27)

0|npm      |     at loadPosts.throw (<anonymous>)

0|npm      |     at next (/home/ubuntu/react_nodebird/front/node_modules/@redux-saga/core/dist/redux-saga-core.prod.cjs.js:1071:32)

0|npm      |     at currCb (/home/ubuntu/react_nodebird/front/node_modules/@redux-saga/core/dist/redux-saga-core.prod.cjs.js:1196:7)

0|npm      |     at /home/ubuntu/react_nodebird/front/node_module

s/@redux-saga/core/dist/redux-saga-core.prod.cjs.js:347:5      

0|npm      |     at processTicksAndRejections (internal/process/task_queues.js:95:5)

게시물 불러오는 과정에서 에러가 난 것 같은데

인덱스 사가에서 axios.defaults.baseURL = backUrl;

이거도 추가했는데 무엇이 문제인지를 모르겠네요...

redux react nodejs express Next.js

답변 1

0

제로초(조현영)

backURL을 백엔드 서버 ip나 도메인으로 수정하셨나요?

0

huhu

네네 백엔드 도메인 주소로 해놨습니다ㅠㅠㅠ

혹시 오타가 났을까 싶어 loadPosts 부분

리듀서, 사가, routes/posts.js 까지

제로초님 소스 복붙해봤는데도 에러가 그대로네요ㅠㅠㅠ

0

huhu

연결하다 시간 초과로 끝날 때까지 기다려보고

로그를 살핀 결과

 

0|npm  | Error: connect ETIMEDOUT 13.209.67.0:80

0|npm  |     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1159:16) {

0|npm  |   errno: -110,

0|npm  |   code: 'ETIMEDOUT',

0|npm  |   syscall: 'connect',

0|npm  |   address: '13.209.67.0',

0|npm  |   port: 80,

0|npm  |   config: {

0|npm  |     transitional: {

0|npm  |       silentJSONParsing: true,

0|npm  |       forcedJSONParsing: true,

0|npm  |       clarifyTimeoutError: false

0|npm  |     },

0|npm  |     adapter: [Function: httpAdapter],

0|npm  |     transformRequest: [ [Function: transformRequest] ],

0|npm  |     transformResponse: [ [Function: transformResponse] ],

0|npm  |     timeout: 0,

0|npm  |     xsrfCookieName: 'XSRF-TOKEN',

0|npm  |     xsrfHeaderName: 'X-XSRF-TOKEN',

0|npm  |     maxContentLength: -1,

0|npm  |     maxBodyLength: -1,

0|npm  |     validateStatus: [Function: validateStatus],

0|npm  |     headers: {

0|npm  |       Accept: 'application/json, text/plain, */*',

0|npm  |       Cookie: '',

0|npm  |       'User-Agent': 'axios/0.25.0'

0|npm  |     },

0|npm  |     baseURL: 'http://13.209.67.0',

0|npm  |     withCredentials: true,

0|npm  |     method: 'get',

0|npm  |     url: '/posts?lastId=0',

0|npm  |     data: undefined

0|npm  |   },

0|npm  |   request: <ref *1> Writable {

0|npm  |     _writableState: WritableState {

0|npm  |       objectMode: false,

0|npm  |       highWaterMark: 16384,

0|npm  |       finalCalled: false,

0|npm  |       needDrain: false,

0|npm  |       ending: false,

0|npm  |       ended: false,

0|npm  |       finished: false,

0|npm  |       destroyed: false,

0|npm  |       decodeStrings: true,

0|npm  |       defaultEncoding: 'utf8',

0|npm  |       length: 0,

0|npm  |       writing: false,

0|npm  |       corked: 0,

0|npm  |       sync: true,

0|npm  |       bufferProcessing: false,

0|npm  |       onwrite: [Function: bound onwrite],

0|npm  |       writecb: null,

0|npm  |       writelen: 0,

0|npm  |       afterWriteTickInfo: null,

0|npm  |       buffered: [],

0|npm  |       bufferedIndex: 0,

0|npm  |       allBuffers: true,

0|npm  |       allNoop: true,

0|npm  |       pendingcb: 0,

0|npm  |       prefinished: false,

0|npm  |       errorEmitted: false,

0|npm  |       emitClose: true,

0|npm  |       autoDestroy: true,

0|npm  |       errored: null,

0|npm  |       closed: false

0|npm  |     },

0|npm  |     _events: [Object: null prototype] {

0|npm  |       response: [Function: handleResponse],

0|npm  |       error: [Function: handleRequestError],

0|npm  |       socket: [Function: handleRequestSocket]

0|npm  |     },

0|npm  |     _eventsCount: 3,

0|npm  |     _maxListeners: undefined,

0|npm  |     _options: {

0|npm  |       maxRedirects: 21,

0|npm  |       maxBodyLength: 10485760,

0|npm  |       protocol: 'http:',

0|npm  |       path: '/posts?lastId=0',

0|npm  |       method: 'GET',

0|npm  |       headers: [Object],

0|npm  |       agent: undefined,

0|npm  |       agents: [Object],

0|npm  |       auth: undefined,

0|npm  |       hostname: '13.209.67.0',

0|npm  |       port: null,

0|npm  |       nativeProtocols: [Object],

0|npm  |       pathname: '/posts',

0|npm  |       search: '?lastId=0'

0|npm  |     },

0|npm  |     _ended: true,

0|npm  |     _ending: true,

0|npm  |     _redirectCount: 0,

0|npm  |     _redirects: [],

0|npm  |     _requestBodyLength: 0,

0|npm  |     _requestBodyBuffers: [],

0|npm  |     _onNativeResponse: [Function (anonymous)],

0|npm  |     _currentRequest: ClientRequest {

0|npm  |       _events: [Object: null prototype],

0|npm  |       _eventsCount: 7,

0|npm  |       _maxListeners: undefined,

0|npm  |       outputData: [],

0|npm  |       outputSize: 0,

0|npm  |       writable: true,

0|npm  |       destroyed: false,

0|npm  |       _last: true,

0|npm  |       chunkedEncoding: false,

0|npm  |       shouldKeepAlive: false,

0|npm  |       _defaultKeepAlive: true,

0|npm  |       useChunkedEncodingByDefault: false,

0|npm  |       sendDate: false,

0|npm  |       _removedConnection: false,

0|npm  |       _removedContLen: false,

0|npm  |       _removedTE: false,

0|npm  |       _contentLength: 0,

0|npm  |       _hasBody: true,

0|npm  |       _trailer: '',

0|npm  |       finished: true,

0|npm  |       _headerSent: true,

0|npm  |       socket: [Socket],

0|npm  |       _header: 'GET /posts?lastId=0 HTTP/1.1\r\n' +

0|npm  |         'Accept: application/json, text/plain, */*\r\n' +

0|npm  |         'Cookie: \r\n' +

0|npm  |         'User-Agent: axios/0.25.0\r\n' +

0|npm  |         'Host: 13.209.67.0\r\n' +

0|npm  |         'Connection: close\r\n' +

0|npm  |         '\r\n',

0|npm  |       _keepAliveTimeout: 0,

0|npm  |       _onPendingData: [Function: noopPendingOutput],

0|npm  |       agent: [Agent],

0|npm  |       socketPath: undefined,

0|npm  |       method: 'GET',

0|npm  |       maxHeaderSize: undefined,

0|npm  |       insecureHTTPParser: undefined,

0|npm  |       path: '/posts?lastId=0',

0|npm  |       _ended: false,

0|npm  |       res: null,

0|npm  |       aborted: false,

0|npm  |       timeoutCb: null,

0|npm  |       upgradeOrConnect: false,

0|npm  |       parser: null,

0|npm  |       maxHeadersCount: null,

0|npm  |       reusedSocket: false,

0|npm  |       host: '13.209.67.0',

0|npm  |       protocol: 'http:',

0|npm  |       _redirectable: [Circular *1],

0|npm  |       [Symbol(kCapture)]: false,

0|npm  |       [Symbol(kNeedDrain)]: false,

0|npm  |       [Symbol(corked)]: 0,

0|npm  |       [Symbol(kOutHeaders)]: [Object: null prototype]

0|npm  |     },

0|npm  |     _currentUrl: 'http://13.209.67.0/posts?lastId=0',

0|npm  |     [Symbol(kCapture)]: false

0|npm  |   },

0|npm  |   response: undefined,

0|npm  |   isAxiosError: true,

0|npm  |   toJSON: [Function: toJSON]

0|npm  | }

0|npm  | TypeError: Cannot read property 'data' of undefined

0|npm  |     at loadPosts (/home/ubuntu/react_nodebird/front/.next/server/pages/_app.js:356:27)

0|npm  |     at loadPosts.throw (<anonymous>)

0|npm  |     at next (/home/ubuntu/react_nodebird/front/node_modules/@redux-saga/core/dist/redux-saga-core.prod.cjs.js:1071:32) 

0|npm  |     at currCb (/home/ubuntu/react_nodebird/front/node_modules/@redux-saga/core/dist/redux-saga-core.prod.cjs.js:1196:7)0|npm  |     at /home/ubuntu/react_nodebird/front/node_modules/@redux-saga/core/dist/redux-saga-core.prod.cjs.js:347:5

0|npm  |     at processTicksAndRejections (internal/process/task_queues.js:95:5)

0|npm  | The above error occurred in task loadPosts

0|npm  |     created by takeLatest(LOAD_POSTS_REQUEST, loadPosts)

0|npm  |     created by watchLoadPosts

0|npm  |     created by postSaga

0|npm  |     created by rootSaga

0|npm  | Tasks cancelled due to error:

0|npm  | userSaga

0|npm  | TypeError: Cannot read property 'data' of undefined

0|npm  |     at loadPosts (/home/ubuntu/react_nodebird/front/.next/server/pages/_app.js:356:27)

0|npm  |     at loadPosts.throw (<anonymous>)

0|npm  |     at next (/home/ubuntu/react_nodebird/front/node_modules/@redux-saga/core/dist/redux-saga-core.prod.cjs.js:1071:32) 

0|npm  |     at currCb (/home/ubuntu/react_nodebird/front/node_modules/@redux-saga/core/dist/redux-saga-core.prod.cjs.js:1196:7)0|npm  |     at /home/ubuntu/react_nodebird/front/node_modules/@redux-saga/core/dist/redux-saga-core.prod.cjs.js:347:5

0|npm  |     at processTicksAndRejections (internal/process/task_queues.js:95:5)

baseURL: 'http://13.209.67.0',
host: '13.209.67.0',

backUrl을 고치고 git pull을 하고
npx pm2 reload all
npx pm2 start npm -- start했는데

적용이 안 되고 계속 전 url로 되어있는 것
같아요 어떻게 해야 적용될까요??

1

제로초(조현영)

프론트쪽은 빌드를 다시 하셔야 됩니다. 안그러면 계속 예전 빌드가 남아있습니다!

0

huhu

감사해요ㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠ

넥스트 버젼 질문

0

90

2

로그인시 401 Unauthorized 오류가 뜹니다

0

104

1

무한 스크롤 중 스크롤 튐 현상

0

192

1

특정 페이지 접근을 막고 싶을 때

0

116

2

createGlobalStyle의 위치와 영향범위

0

102

2

인라인 스타일 리렌더링 관련

0

97

2

vsc 에서 npm init 설치시 오류

0

157

2

nextjs 15버전 사용 가능할까요?

0

166

1

화면 새로고침 문의

0

129

1

RTK에서 draft, state 차이가 있나요?

0

160

2

Next 14 사용해도 될까요?

0

455

1

next, node 버전 / 폴더 구조 질문 드립니다.

0

359

1

url 오류 질문있습니다

0

214

1

ssh xxxxx로 우분투에 들어가려니까 port 22: Connection timed out

0

391

1

sudo certbot --nginx 에러

0

1293

2

Minified React error 콘솔에러 (hydrate)

0

477

1

카카오 공유했을 때 이전에 작성했던 글이 나오는 버그

0

255

1

프론트서버 배포 후 EADDRINUSE에러 발생

0

337

1

npm run build 에러

0

525

1

front 서버 npm run build 중에 발생한 에러들

0

399

1

서버 실행하고 브라우저로 들어갔을때 404에러

0

350

2

css 서버사이드 랜더링이 적용되지 않아서 문의 드립니다.

0

290

1

팔로워 3명씩 불러오고 데이터 합쳐주는걸로 바꾸고 서버요청을 무한으로하고있습니다.

0

249

2

해시태그 검색에서 throttle에 관해 질문있습니다.

0

206

1