강의

멘토링

커뮤니티

인프런 커뮤니티 질문&답변

huhu님의 프로필 이미지
huhu

작성한 질문수

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

도메인 연결하기

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

작성

·

195

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;

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

답변 1

0

제로초(조현영)님의 프로필 이미지
제로초(조현영)
지식공유자

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

huhu님의 프로필 이미지
huhu
질문자

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

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

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

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

huhu님의 프로필 이미지
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로 되어있는 것
같아요 어떻게 해야 적용될까요??

제로초(조현영)님의 프로필 이미지
제로초(조현영)
지식공유자

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

huhu님의 프로필 이미지
huhu
질문자

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

huhu님의 프로필 이미지
huhu

작성한 질문수

질문하기