강의

멘토링

커뮤니티

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

br님의 프로필 이미지
br

작성한 질문수

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

로그인이 안되는데 백엔드까지 되돌리고 싶어요

작성

·

626

·

수정됨

0

      [Symbol(kSetNoDelay)]: false,

      [Symbol(kSetKeepAlive)]: true,

      [Symbol(kSetKeepAliveInitialDelay)]: 60,

      [Symbol(kBytesRead)]: 1312,

      [Symbol(kBytesWritten)]: 198,

      [Symbol(RequestTimeout)]: undefined

    },

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

      'Accept: application/json, text/plain, /\r\n' +

      'Cookie: \r\n' +

      'User-Agent: axios/1.1.2\r\n' +

      'Accept-Encoding: gzip, deflate, br\r\n' +

      'Host: localhost:3060\r\n' +

      'Connection: close\r\n' +

      '\r\n',

    _keepAliveTimeout: 0,

    _onPendingData: [Function: nop],

    agent: Agent {

      _events: [Object: null prototype],

      _eventsCount: 2,

      _maxListeners: undefined,

      defaultPort: 80,

      protocol: 'http:',

      options: [Object: null prototype],

      requests: [Object: null prototype] {},

      sockets: [Object: null prototype],

      freeSockets: [Object: null prototype] {},

      keepAliveMsecs: 1000,

      keepAlive: false,

      maxSockets: Infinity,

      maxFreeSockets: 256,

      scheduling: 'lifo',

      maxTotalSockets: Infinity,

      totalSocketCount: 21,

      [Symbol(kCapture)]: false

    },

    socketPath: undefined,

    method: 'GET',

    maxHeaderSize: undefined,

    insecureHTTPParser: undefined,

    path: '/user/login/posts?lastId=0',

    _ended: true,

    res: IncomingMessage {

      _readableState: [ReadableState],

      _events: [Object: null prototype],

      _eventsCount: 4,

      _maxListeners: undefined,

      socket: [Socket],

      httpVersionMajor: 1,

      httpVersionMinor: 1,

      httpVersion: '1.1',

      complete: true,

      rawHeaders: [Array],

      rawTrailers: [],

      aborted: false,

      upgrade: false,

      url: '',

      method: null,

      statusCode: 404,

      statusMessage: 'Not Found',

      client: [Socket],

      _consuming: false,

      _dumped: false,

      req: [Circular *1],

      responseUrl: 'http://localhost:3060/user/login/posts?lastId=0',

      redirects: [],

      [Symbol(kCapture)]: false,

      [Symbol(kHeaders)]: [Object],

      [Symbol(kHeadersCount)]: 18,

      [Symbol(kTrailers)]: null,

      [Symbol(kTrailersCount)]: 0,

      [Symbol(RequestTimeout)]: undefined

    },

    aborted: false,

    timeoutCb: null,

    upgradeOrConnect: false,

    parser: null,

    maxHeadersCount: null,

    reusedSocket: false,

    host: 'localhost',

    protocol: 'http:',

    _redirectable: Writable {

      _writableState: [WritableState],

      _events: [Object: null prototype],

      _eventsCount: 3,

      _maxListeners: undefined,

      _options: [Object],

      _ended: true,

      _ending: true,

      _redirectCount: 0,

      _redirects: [],

      _requestBodyLength: 0,

      _requestBodyBuffers: [],

      _onNativeResponse: [Function (anonymous)],

      _currentRequest: [Circular *1],

      _currentUrl: 'http://localhost:3060/user/login/posts?lastId=0',

      [Symbol(kCapture)]: false

    },

    [Symbol(kCapture)]: false,

    [Symbol(kBytesWritten)]: 0,

    [Symbol(kEndCalled)]: true,

    [Symbol(kNeedDrain)]: false,

    [Symbol(corked)]: 0,

    [Symbol(kOutHeaders)]: [Object: null prototype] {

      accept: [Array],

      cookie: [Array],

      'user-agent': [Array],

      'accept-encoding': [Array],

      host: [Array]

    },

    [Symbol(kUniqueHeaders)]: null

  },

  response: {

    status: 404,

    statusText: 'Not Found',

    headers: AxiosHeaders {

      'cache-control': 'no-store, must-revalidate',

      'x-powered-by': 'Next.js',

      etag: '"97a-kcoLbH4v9/9OC6V5ZJ+Im5f6nEk"',

      'content-type': 'text/html; charset=utf-8',

      vary: 'Accept-Encoding',

      date: 'Tue, 28 Feb 2023 17:16:27 GMT',

      connection: 'close',

      'transfer-encoding': 'chunked',

      [Symbol(defaults)]: null

    },

    config: {

      transitional: [Object],

      adapter: [Function: httpAdapter],

      transformRequest: [Array],

      transformResponse: [Array],

      timeout: 0,

      xsrfCookieName: 'XSRF-TOKEN',

      xsrfHeaderName: 'X-XSRF-TOKEN',

      maxContentLength: -1,

      maxBodyLength: -1,

      env: [Object],

      validateStatus: [Function: validateStatus],

      headers: [AxiosHeaders],

      baseURL: 'http://localhost:3060',

      withCredentials: true,

      method: 'get',

      url: '/user/login/posts?lastId=0',

      data: undefined

    },

    request: <ref *1> ClientRequest {

      _events: [Object: null prototype],

      _eventsCount: 7,

      _maxListeners: undefined,

      outputData: [],

      outputSize: 0,

      writable: true,

      destroyed: true,

      _last: true,

      chunkedEncoding: false,

      shouldKeepAlive: false,

      maxRequestsOnConnectionReached: false,

      _defaultKeepAlive: true,

      useChunkedEncodingByDefault: false,

      sendDate: false,

      _removedConnection: false,

      _removedContLen: false,

      _removedTE: false,

      strictContentLength: false,

      _contentLength: 0,

      _hasBody: true,

      _trailer: '',

      finished: true,

      _headerSent: true,

      _closed: true,

      socket: [Socket],

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

        'Accept: application/json, text/plain, /\r\n' +

        'Cookie: \r\n' +

        'User-Agent: axios/1.1.2\r\n' +

        'Accept-Encoding: gzip, deflate, br\r\n' +

        'Host: localhost:3060\r\n' +

        'Connection: close\r\n' +

        '\r\n',

      _keepAliveTimeout: 0,

      _onPendingData: [Function: nop],

      agent: [Agent],

      socketPath: undefined,

      method: 'GET',

      maxHeaderSize: undefined,

      insecureHTTPParser: undefined,

      path: '/user/login/posts?lastId=0',

      _ended: true,

      res: [IncomingMessage],

      aborted: false,

      timeoutCb: null,

      upgradeOrConnect: false,

      parser: null,

      maxHeadersCount: null,

      reusedSocket: false,

      host: 'localhost',

      protocol: 'http:',

      _redirectable: [Writable],

      [Symbol(kCapture)]: false,

      [Symbol(kBytesWritten)]: 0,

      [Symbol(kEndCalled)]: true,

      [Symbol(kNeedDrain)]: false,

      [Symbol(corked)]: 0,

      [Symbol(kOutHeaders)]: [Object: null prototype],

      [Symbol(kUniqueHeaders)]: null

    },

    data: '<!DOCTYPE html><html><head><style data-next-hide-fouc="true">body{display:none}</style><noscript data-next-hide-fouc="true"><style>body{display:block}</style></noscript><meta name="viewport" content="width=device-width"/><meta charSet="utf-8"/><title>: An unexpected error has occurred</title><noscript data-n-css="true"></noscript><link rel="preload" href="/_next/static/chunks/main.js?ts=1677604587215" as="script"/><link rel="preload" href="/_next/static/chunks/webpack.js?ts=1677604587215" as="script"/><link rel="preload" href="/_next/static/chunks/pages/_app.js?ts=1677604587215" as="script"/><noscript id="__next_css__DO_NOT_USE__"></noscript><style data-styled="" data-styled-version="5.3.6"></style></head><body><script src="https://polyfill.io/v3/polyfill.min.js?features=default%2Cdom4%2Ces2015%2Ces2016%2Ces2017%2Ces2018%2Ces2019%2Ces2022%2Ces2021%2Ces2020"></script><div id="__next"><div style="color:#000;background:#fff;font-family:-apple-system, BlinkMacSystemFont, Roboto, &quot;Segoe UI&quot;, &quot;Fira Sans&quot;, Avenir, &quot;Helvetica Neue&quot;, &quot;Lucida Grande&quot;, sans-serif;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>body { margin: 0 }</style><div style="display:inline-block;text-align:left;line-height:49px;height:49px;vertical-align:middle"><h2 style="font-size:14px;font-weight:normal;line-height:inherit;margin:0;padding:0">An unexpected error has occurred<!-- -->.</h2></div></div></div></div><script src="/_next/static/chunks/react-refresh.js?ts=1677604587215"></script><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{"lastId":"0"},"buildId":"development","isFallback":false,"gip":true,"head":[["meta",{"name":"viewport","content":"width=device-width"}],["meta",{"charSet":"utf-8"}],["title",{"children":": An unexpected error has occurred"}]]}</script><script nomodule="" src="/_next/static/chunks/polyfills.js?ts=1677604587215"></script><script src="/_next/static/chunks/main.js?ts=1677604587215"></script><script src="/_next/static/chunks/webpack.js?ts=1677604587215"></script><script src="/_next/static/chunks/pages/_app.js?ts=1677604587215"></script><script src="/_next/static/development/_buildManifest.js?ts=1677604587215"></script><script src="/_next/static/development/_ssgManifest.js?ts=1677604587215"></script></body></html>'

  }

}

{

  type: 'LOAD_USER_POSTS_FAILURE',

  error: '<!DOCTYPE html><html><head><style data-next-hide-fouc="true">body{display:none}</style><noscript data-next-hide-fouc="true"><style>body{display:block}</style></noscript><meta name="viewport" content="width=device-width"/><meta charSet="utf-8"/><title>: An unexpected error has occurred</title><noscript data-n-css="true"></noscript><link rel="preload" href="/_next/static/chunks/main.js?ts=1677604587215" as="script"/><link rel="preload" href="/_next/static/chunks/webpack.js?ts=1677604587215" as="script"/><link rel="preload" href="/_next/static/chunks/pages/_app.js?ts=1677604587215" as="script"/><noscript id="__next_css__DO_NOT_USE__"></noscript><style data-styled="" data-styled-version="5.3.6"></style></head><body><script src="https://polyfill.io/v3/polyfill.min.js?features=default%2Cdom4%2Ces2015%2Ces2016%2Ces2017%2Ces2018%2Ces2019%2Ces2022%2Ces2021%2Ces2020"></script><div id="__next"><div style="color:#000;background:#fff;font-family:-apple-system, BlinkMacSystemFont, Roboto, &quot;Segoe UI&quot;, &quot;Fira Sans&quot;, Avenir, &quot;Helvetica Neue&quot;, &quot;Lucida Grande&quot;, sans-serif;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>body { margin: 0 }</style><div style="display:inline-block;text-align:left;line-height:49px;height:49px;vertical-align:middle"><h2 style="font-size:14px;font-weight:normal;line-height:inherit;margin:0;padding:0">An unexpected error has occurred<!-- -->.</h2></div></div></div></div><script src="/_next/static/chunks/react-refresh.js?ts=1677604587215"></script><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{"lastId":"0"},"buildId":"development","isFallback":false,"gip":true,"head":[["meta",{"name":"viewport","content":"width=device-width"}],["meta",{"charSet":"utf-8"}],["title",{"children":": An unexpected error has occurred"}]]}</script><script nomodule="" src="/_next/static/chunks/polyfills.js?ts=1677604587215"></script><script src="/_next/static/chunks/main.js?ts=1677604587215"></script><script src="/_next/static/chunks/webpack.js?ts=1677604587215"></script><script src="/_next/static/chunks/pages/_app.js?ts=1677604587215"></script><script src="/_next/static/development/_buildManifest.js?ts=1677604587215"></script><script src="/_next/static/development/_ssgManifest.js?ts=1677604587215"></script></body></html>'

}

1. getProps created store with state {

  user: {

    loadMyInfoLoading: false,

    loadMyInfoDone: false,

    loadMyInfoError: null,

    loadUserLoading: false,

    loadUserDone: false,

    loadUserError: null,

    followLoading: false,

    followDone: false,

    followError: null,

    unfollowLoading: false,

    unfollowDone: false,

    unfollowError: null,

    logInLoading: false,

    logInDone: false,

    logInError: null,

    logOutLoading: false,

    logOutDone: false,

    logOutError: null,

    signUpLoading: false,

    signUpDone: false,

    signUpError: null,

    changeNicknameLoading: false,

    changeNicknameDone: false,

    changeNicknameError: null,

    loadFollowingsLoading: false,

    loadFollowingsDone: false,

    loadFollowingsError: null,

    loadFollowersLoading: false,

    loadFollowersDone: false,

    loadFollowersError: null,

    removeFollowerLoading: false,

    removeFollowerDone: false,

    removeFollowerError: null,

    me: null,

    userInfo: null

  },

  post: {

    mainPosts: [],

    singlePost: null,

    imagePaths: [],

    hasMorePosts: true,

    likePostLoading: false,

    likePostDone: false,

    likePostError: null,

    unlikePostLoading: false,

    unlikePostDone: false,

    unlikePostError: null,

    loadPostLoading: false,

    loadPostDone: false,

    loadPostError: null,

    loadPostsLoading: false,

    loadPostsDone: false,

    loadPostsError: null,

    addPostLoading: false,

    addPostDone: false,

    addPostError: null,

    removePostLoading: false,

    removePostDone: false,

    removePostError: null,

    addCommentLoading: false,

    addCommentDone: false,

    addCommentError: null,

    uploadImagesLoading: false,

    uploadImagesDone: false,

    uploadImagesError: null,

    retweetLoading: false,

    retweetDone: false,

    retweetError: null

  }

}

{ type: 'LOAD_USER_POSTS_REQUEST', data: 'login' }

{ type: 'LOAD_MY_INFO_REQUEST' }

{ type: 'LOAD_USER_REQUEST', data: 'login' }

{ type: '@@redux-saga/CHANNEL_END' }

4. WrappedApp created new store with withRedux(NodeBird) { initialState: undefined, initialStateFromGSPorGSSR: undefined }

4. WrappedApp created new store with withRedux(NodeBird) { initialState: undefined, initialStateFromGSPorGSSR: undefined }

AxiosError: Request failed with status code 404

    at settle (C:\JS_workspace\React\js_prepare\front\node_modules\axios\dist\node\axios.cjs:1261:12)

    at Unzip.handleStreamEnd (C:\JS_workspace\React\js_prepare\front\node_modules\axios\dist\node\axios.cjs:2444:11)

    at Unzip.emit (node:events:525:35)

    at endReadableNT (node:internal/streams/readable:1358:12)

    at processTicksAndRejections (node:internal/process/task_queues:83:21) {

  code: 'ERR_BAD_REQUEST',

  config: {

    transitional: {

      silentJSONParsing: true,

      forcedJSONParsing: true,

      clarifyTimeoutError: false

    },

    adapter: [Function: httpAdapter],

    transformRequest: [ [Function: transformRequest] ],

    transformResponse: [ [Function: transformResponse] ],

    timeout: 0,

    xsrfCookieName: 'XSRF-TOKEN',

    xsrfHeaderName: 'X-XSRF-TOKEN',

    maxContentLength: -1,

    maxBodyLength: -1,

    env: { FormData: [Function], Blob: null },

    validateStatus: [Function: validateStatus],

    headers: AxiosHeaders {

      Cookie: '',

      'User-Agent': 'axios/1.1.2',

      'Accept-Encoding': 'gzip, deflate, br',

      [Symbol(defaults)]: [Object]

    },

    baseURL: 'http://localhost:3060',

    withCredentials: true,

    method: 'get',

    url: '/user/login/posts?lastId=0',

    data: undefined

  },

  request: <ref *1> ClientRequest {

    _events: [Object: null prototype] {

      abort: [Function (anonymous)],

      aborted: [Function (anonymous)],

      connect: [Function (anonymous)],

      error: [Function (anonymous)],

      socket: [Function (anonymous)],

      timeout: [Function (anonymous)],

      finish: [Function: requestOnFinish]

    },

    _eventsCount: 7,

    _maxListeners: undefined,

    outputData: [],

    outputSize: 0,

    writable: true,

    destroyed: true,

    _last: true,

    chunkedEncoding: false,

    shouldKeepAlive: false,

    maxRequestsOnConnectionReached: false,

    _defaultKeepAlive: true,

    useChunkedEncodingByDefault: false,

    sendDate: false,

    _removedConnection: false,

    _removedContLen: false,

    _removedTE: false,

    strictContentLength: false,

    _contentLength: 0,

    _hasBody: true,

    _trailer: '',

    finished: true,

    _headerSent: true,

    _closed: true,

    socket: Socket {

      connecting: false,

      _hadError: false,

      _parent: null,

      _host: 'localhost',

      _closeAfterHandlingError: false,

      _readableState: [ReadableState],

      _events: [Object: null prototype],

      _eventsCount: 6,

      _maxListeners: undefined,

      _writableState: [WritableState],

      allowHalfOpen: false,

      _sockname: null,

      _pendingData: null,

      _pendingEncoding: '',

      server: null,

      _server: null,

      parser: null,

      _httpMessage: [Circular *1],

      [Symbol(async_id_symbol)]: 965656,

      [Symbol(kHandle)]: null,

      [Symbol(lastWriteQueueSize)]: 0,

      [Symbol(timeout)]: null,

      [Symbol(kBuffer)]: null,

      [Symbol(kBufferCb)]: null,

      [Symbol(kBufferGen)]: null,

      [Symbol(kCapture)]: false,

      [Symbol(kSetNoDelay)]: false,

      [Symbol(kSetKeepAlive)]: true,

      [Symbol(kSetKeepAliveInitialDelay)]: 60,

      [Symbol(kBytesRead)]: 1312,

      [Symbol(kBytesWritten)]: 198,

      [Symbol(RequestTimeout)]: undefined

    },

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

      'Accept: application/json, text/plain, /\r\n' +

      'Cookie: \r\n' +

      'User-Agent: axios/1.1.2\r\n' +

      'Accept-Encoding: gzip, deflate, br\r\n' +

      'Host: localhost:3060\r\n' +

      'Connection: close\r\n' +

      '\r\n',

    _keepAliveTimeout: 0,

    _onPendingData: [Function: nop],

    agent: Agent {

      _events: [Object: null prototype],

      _eventsCount: 2,

      _maxListeners: undefined,

      defaultPort: 80,

      protocol: 'http:',

      options: [Object: null prototype],

      requests: [Object: null prototype] {},

      sockets: [Object: null prototype],

      freeSockets: [Object: null prototype] {},

      keepAliveMsecs: 1000,

      keepAlive: false,

      maxSockets: Infinity,

      maxFreeSockets: 256,

      scheduling: 'lifo',

      maxTotalSockets: Infinity,

      totalSocketCount: 23,

      [Symbol(kCapture)]: false

    },

    socketPath: undefined,

    method: 'GET',

    maxHeaderSize: undefined,

    insecureHTTPParser: undefined,

    path: '/user/login/posts?lastId=0',

    _ended: true,

    res: IncomingMessage {

      _readableState: [ReadableState],

      _events: [Object: null prototype],

      _eventsCount: 4,

      _maxListeners: undefined,

      socket: [Socket],

      httpVersionMajor: 1,

      httpVersionMinor: 1,

      httpVersion: '1.1',

      complete: true,

      rawHeaders: [Array],

      rawTrailers: [],

      aborted: false,

      upgrade: false,

      url: '',

      method: null,

      statusCode: 404,

      statusMessage: 'Not Found',

      client: [Socket],

      _consuming: false,

      _dumped: false,

      req: [Circular *1],

      responseUrl: 'http://localhost:3060/user/login/posts?lastId=0',

      redirects: [],

      [Symbol(kCapture)]: false,

      [Symbol(kHeaders)]: [Object],

      [Symbol(kHeadersCount)]: 18,

      [Symbol(kTrailers)]: null,

      [Symbol(kTrailersCount)]: 0,

      [Symbol(RequestTimeout)]: undefined

    },

    aborted: false,

    timeoutCb: null,

    upgradeOrConnect: false,

    parser: null,

    maxHeadersCount: null,

    reusedSocket: false,

    host: 'localhost',

    protocol: 'http:',

    _redirectable: Writable {

      _writableState: [WritableState],

      _events: [Object: null prototype],

      _eventsCount: 3,

      _maxListeners: undefined,

      _options: [Object],

      _ended: true,

      _ending: true,

      _redirectCount: 0,

      _redirects: [],

      _requestBodyLength: 0,

      _requestBodyBuffers: [],

      _onNativeResponse: [Function (anonymous)],

      _currentRequest: [Circular *1],

      _currentUrl: 'http://localhost:3060/user/login/posts?lastId=0',

      [Symbol(kCapture)]: false

    },

    [Symbol(kCapture)]: false,

    [Symbol(kBytesWritten)]: 0,

    [Symbol(kEndCalled)]: true,

    [Symbol(kNeedDrain)]: false,

    [Symbol(corked)]: 0,

    [Symbol(kOutHeaders)]: [Object: null prototype] {

      accept: [Array],

      cookie: [Array],

      'user-agent': [Array],

      'accept-encoding': [Array],

      host: [Array]

    },

    [Symbol(kUniqueHeaders)]: null

  },

  response: {

    status: 404,

    statusText: 'Not Found',

    headers: AxiosHeaders {

      'cache-control': 'no-store, must-revalidate',

      'x-powered-by': 'Next.js',

      etag: '"97a-oa4gEZ9VQR+Dh2MJsRlW/Zuu95Q"',

      'content-type': 'text/html; charset=utf-8',

      vary: 'Accept-Encoding',

      date: 'Tue, 28 Feb 2023 17:16:27 GMT',

      connection: 'close',

      'transfer-encoding': 'chunked',

      [Symbol(defaults)]: null

    },

    config: {

      transitional: [Object],

      adapter: [Function: httpAdapter],

      transformRequest: [Array],

      transformResponse: [Array],

      timeout: 0,

      xsrfCookieName: 'XSRF-TOKEN',

      xsrfHeaderName: 'X-XSRF-TOKEN',

      maxContentLength: -1,

      maxBodyLength: -1,

      env: [Object],

      validateStatus: [Function: validateStatus],

      headers: [AxiosHeaders],

      baseURL: 'http://localhost:3060',

      withCredentials: true,

      method: 'get',

      url: '/user/login/posts?lastId=0',

      data: undefined

    },

    request: <ref *1> ClientRequest {

      _events: [Object: null prototype],

      _eventsCount: 7,

      _maxListeners: undefined,

      outputData: [],

      outputSize: 0,

      writable: true,

      destroyed: true,

      _last: true,

      chunkedEncoding: false,

      shouldKeepAlive: false,

      maxRequestsOnConnectionReached: false,

      _defaultKeepAlive: true,

      useChunkedEncodingByDefault: false,

      sendDate: false,

      _removedConnection: false,

      _removedContLen: false,

      _removedTE: false,

      strictContentLength: false,

      _contentLength: 0,

      _hasBody: true,

      _trailer: '',

      finished: true,

      _headerSent: true,

      _closed: true,

      socket: [Socket],

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

        'Accept: application/json, text/plain, /\r\n' +

        'Cookie: \r\n' +

        'User-Agent: axios/1.1.2\r\n' +

        'Accept-Encoding: gzip, deflate, br\r\n' +

        'Host: localhost:3060\r\n' +

        'Connection: close\r\n' +

        '\r\n',

      _keepAliveTimeout: 0,

      _onPendingData: [Function: nop],

      agent: [Agent],

      socketPath: undefined,

      method: 'GET',

      maxHeaderSize: undefined,

      insecureHTTPParser: undefined,

      path: '/user/login/posts?lastId=0',

      _ended: true,

      res: [IncomingMessage],

      aborted: false,

      timeoutCb: null,

      upgradeOrConnect: false,

      parser: null,

      maxHeadersCount: null,

      reusedSocket: false,

      host: 'localhost',

      protocol: 'http:',

      _redirectable: [Writable],

      [Symbol(kCapture)]: false,

      [Symbol(kBytesWritten)]: 0,

      [Symbol(kEndCalled)]: true,

      [Symbol(kNeedDrain)]: false,

      [Symbol(corked)]: 0,

      [Symbol(kOutHeaders)]: [Object: null prototype],

      [Symbol(kUniqueHeaders)]: null

    },

    data: '<!DOCTYPE html><html><head><style data-next-hide-fouc="true">body{display:none}</style><noscript data-next-hide-fouc="true"><style>body{display:block}</style></noscript><meta name="viewport" content="width=device-width"/><meta charSet="utf-8"/><title>: An unexpected error has occurred</title><noscript data-n-css="true"></noscript><link rel="preload" href="/_next/static/chunks/main.js?ts=1677604587289" as="script"/><link rel="preload" href="/_next/static/chunks/webpack.js?ts=1677604587289" as="script"/><link rel="preload" href="/_next/static/chunks/pages/_app.js?ts=1677604587289" as="script"/><noscript id="__next_css__DO_NOT_USE__"></noscript><style data-styled="" data-styled-version="5.3.6"></style></head><body><script src="https://polyfill.io/v3/polyfill.min.js?features=default%2Cdom4%2Ces2015%2Ces2016%2Ces2017%2Ces2018%2Ces2019%2Ces2022%2Ces2021%2Ces2020"></script><div id="__next"><div style="color:#000;background:#fff;font-family:-apple-system, BlinkMacSystemFont, Roboto, &quot;Segoe UI&quot;, &quot;Fira Sans&quot;, Avenir, &quot;Helvetica Neue&quot;, &quot;Lucida Grande&quot;, sans-serif;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>body { margin: 0 }</style><div style="display:inline-block;text-align:left;line-height:49px;height:49px;vertical-align:middle"><h2 style="font-size:14px;font-weight:normal;line-height:inherit;margin:0;padding:0">An unexpected error has occurred<!-- -->.</h2></div></div></div></div><script src="/_next/static/chunks/react-refresh.js?ts=1677604587289"></script><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{"lastId":"0"},"buildId":"development","isFallback":false,"gip":true,"head":[["meta",{"name":"viewport","content":"width=device-width"}],["meta",{"charSet":"utf-8"}],["title",{"children":": An unexpected error has occurred"}]]}</script><script nomodule="" src="/_next/static/chunks/polyfills.js?ts=1677604587289"></script><script src="/_next/static/chunks/main.js?ts=1677604587289"></script><script src="/_next/static/chunks/webpack.js?ts=1677604587289"></script><script src="/_next/static/chunks/pages/_app.js?ts=1677604587289"></script><script src="/_next/static/development/_buildManifest.js?ts=1677604587289"></script><script src="/_next/static/development/_ssgManifest.js?ts=1677604587289"></script></body></html>'

  }

}

{

  type: 'LOAD_USER_POSTS_FAILURE',

  error: '<!DOCTYPE html><html><head><style data-next-hide-fouc="true">body{display:none}</style><noscript data-next-hide-fouc="true"><style>body{display:block}</style></noscript><meta name="viewport" content="width=device-width"/><meta charSet="utf-8"/><title>: An unexpected error has occurred</title><noscript data-n-css="true"></noscript><link rel="preload" href="/_next/static/chunks/main.js?ts=1677604587289" as="script"/><link rel="preload" href="/_next/static/chunks/webpack.js?ts=1677604587289" as="script"/><link rel="preload" href="/_next/static/chunks/pages/_app.js?ts=1677604587289" as="script"/><noscript id="__next_css__DO_NOT_USE__"></noscript><style data-styled="" data-styled-version="5.3.6"></style></head><body><script src="https://polyfill.io/v3/polyfill.min.js?features=default%2Cdom4%2Ces2015%2Ces2016%2Ces2017%2Ces2018%2Ces2019%2Ces2022%2Ces2021%2Ces2020"></script><div id="__next"><div style="color:#000;background:#fff;font-family:-apple-system, BlinkMacSystemFont, Roboto, &quot;Segoe UI&quot;, &quot;Fira Sans&quot;, Avenir, &quot;Helvetica Neue&quot;, &quot;Lucida Grande&quot;, sans-serif;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>body { margin: 0 }</style><div style="display:inline-block;text-align:left;line-height:49px;height:49px;vertical-align:middle"><h2 style="font-size:14px;font-weight:normal;line-height:inherit;margin:0;padding:0">An unexpected error has occurred<!-- -->.</h2></div></div></div></div><script src="/_next/static/chunks/react-refresh.js?ts=1677604587289"></script><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{"lastId":"0"},"buildId":"development","isFallback":false,"gip":true,"head":[["meta",{"name":"viewport","content":"width=device-width"}],["meta",{"charSet":"utf-8"}],["title",{"children":": An unexpected error has occurred"}]]}</script><script nomodule="" src="/_next/static/chunks/polyfills.js?ts=1677604587289"></script><script src="/_next/static/chunks/main.js?ts=1677604587289"></script><script src="/_next/static/chunks/webpack.js?ts=1677604587289"></script><script src="/_next/static/chunks/pages/_app.js?ts=1677604587289"></script><script src="/_next/static/development/_buildManifest.js?ts=1677604587289"></script><script src="/_next/static/development/_ssgManifest.js?ts=1677604587289"></script></body></html>'

}

AxiosError: Request failed with status code 404

    at settle (C:\JS_workspace\React\js_prepare\front\node_modules\axios\dist\node\axios.cjs:1261:12)

    at Unzip.handleStreamEnd (C:\JS_workspace\React\js_prepare\front\node_modules\axios\dist\node\axios.cjs:2444:11)

    at Unzip.emit (node:events:525:35)

    at endReadableNT (node:internal/streams/readable:1358:12)

    at processTicksAndRejections (node:internal/process/task_queues:83:21) {

  code: 'ERR_BAD_REQUEST',

  config: {

    transitional: {

      silentJSONParsing: true,

      forcedJSONParsing: true,

      clarifyTimeoutError: false

    },

    adapter: [Function: httpAdapter],

    transformRequest: [ [Function: transformRequest] ],

    transformResponse: [ [Function: transformResponse] ],

    timeout: 0,

    xsrfCookieName: 'XSRF-TOKEN',

    xsrfHeaderName: 'X-XSRF-TOKEN',

    maxContentLength: -1,

    maxBodyLength: -1,

    env: { FormData: [Function], Blob: null },

    validateStatus: [Function: validateStatus],

    headers: AxiosHeaders {

      Cookie: '',

      'User-Agent': 'axios/1.1.2',

      'Accept-Encoding': 'gzip, deflate, br',

      [Symbol(defaults)]: [Object]

    },

    baseURL: 'http://localhost:3060',

    withCredentials: true,

    method: 'get',

    url: '/user',

    data: undefined

  },

  request: <ref *1> ClientRequest {

    _events: [Object: null prototype] {

      abort: [Function (anonymous)],

      aborted: [Function (anonymous)],

      connect: [Function (anonymous)],

      error: [Function (anonymous)],

      socket: [Function (anonymous)],

      timeout: [Function (anonymous)],

      finish: [Function: requestOnFinish]

    },

    _eventsCount: 7,

    _maxListeners: undefined,

    outputData: [],

    outputSize: 0,

    writable: true,

    destroyed: true,

    _last: true,

    chunkedEncoding: false,

    shouldKeepAlive: false,

    maxRequestsOnConnectionReached: false,

    _defaultKeepAlive: true,

    useChunkedEncodingByDefault: false,

    sendDate: false,

    _removedConnection: false,

    _removedContLen: false,

    _removedTE: false,

    strictContentLength: false,

    _contentLength: 0,

    _hasBody: true,

    _trailer: '',

    finished: true,

    _headerSent: true,

    _closed: true,

    socket: Socket {

      connecting: false,

      _hadError: false,

      _parent: null,

      _host: 'localhost',

      _closeAfterHandlingError: false,

      _readableState: [ReadableState],

      _events: [Object: null prototype],

      _eventsCount: 6,

      _maxListeners: undefined,

      _writableState: [WritableState],

      allowHalfOpen: false,

      _sockname: null,

      _pendingData: null,

      _pendingEncoding: '',

      server: null,

      _server: null,

      parser: null,

      _httpMessage: [Circular *1],

      [Symbol(async_id_symbol)]: 965660,

      [Symbol(kHandle)]: null,

      [Symbol(lastWriteQueueSize)]: 0,

      [Symbol(timeout)]: null,

      [Symbol(kBuffer)]: null,

      [Symbol(kBufferCb)]: null,

      [Symbol(kBufferGen)]: null,

      [Symbol(kCapture)]: false,

      [Symbol(kSetNoDelay)]: false,

      [Symbol(kSetKeepAlive)]: true,

      [Symbol(kSetKeepAliveInitialDelay)]: 60,

      [Symbol(kBytesRead)]: 1307,

      [Symbol(kBytesWritten)]: 177,

      [Symbol(RequestTimeout)]: undefined

    },

    _header: 'GET /user HTTP/1.1\r\n' +

      'Accept: application/json, text/plain, /\r\n' +

      'Cookie: \r\n' +

      'User-Agent: axios/1.1.2\r\n' +

      'Accept-Encoding: gzip, deflate, br\r\n' +

      'Host: localhost:3060\r\n' +

      'Connection: close\r\n' +

      '\r\n',

    _keepAliveTimeout: 0,

    _onPendingData: [Function: nop],

    agent: Agent {

      _events: [Object: null prototype],

      _eventsCount: 2,

      _maxListeners: undefined,

      defaultPort: 80,

      protocol: 'http:',

      options: [Object: null prototype],

      requests: [Object: null prototype] {},

      sockets: [Object: null prototype],

      freeSockets: [Object: null prototype] {},

      keepAliveMsecs: 1000,

      keepAlive: false,

      maxSockets: Infinity,

      maxFreeSockets: 256,

      scheduling: 'lifo',

      maxTotalSockets: Infinity,

      totalSocketCount: 22,

      [Symbol(kCapture)]: false

    },

    socketPath: undefined,

    method: 'GET',

    maxHeaderSize: undefined,

    insecureHTTPParser: undefined,

    path: '/user',

    _ended: true,

    res: IncomingMessage {

      _readableState: [ReadableState],

      _events: [Object: null prototype],

      _eventsCount: 4,

      _maxListeners: undefined,

      socket: [Socket],

      httpVersionMajor: 1,

      httpVersionMinor: 1,

      httpVersion: '1.1',

      complete: true,

      rawHeaders: [Array],

      rawTrailers: [],

      aborted: false,

      upgrade: false,

      url: '',

      method: null,

      statusCode: 404,

      statusMessage: 'Not Found',

      client: [Socket],

      _consuming: false,

      _dumped: false,

      req: [Circular *1],

      responseUrl: 'http://localhost:3060/user',

      redirects: [],

      [Symbol(kCapture)]: false,

      [Symbol(kHeaders)]: [Object],

      [Symbol(kHeadersCount)]: 18,

      [Symbol(kTrailers)]: null,

      [Symbol(kTrailersCount)]: 0,

      [Symbol(RequestTimeout)]: undefined

    },

    aborted: false,

    timeoutCb: null,

    upgradeOrConnect: false,

    parser: null,

    maxHeadersCount: null,

    reusedSocket: false,

    host: 'localhost',

    protocol: 'http:',

    _redirectable: Writable {

      _writableState: [WritableState],

      _events: [Object: null prototype],

      _eventsCount: 3,

      _maxListeners: undefined,

      _options: [Object],

      _ended: true,

      _ending: true,

      _redirectCount: 0,

      _redirects: [],

      _requestBodyLength: 0,

      _requestBodyBuffers: [],

      _onNativeResponse: [Function (anonymous)],

      _currentRequest: [Circular *1],

      _currentUrl: 'http://localhost:3060/user',

      [Symbol(kCapture)]: false

    },

    [Symbol(kCapture)]: false,

    [Symbol(kBytesWritten)]: 0,

    [Symbol(kEndCalled)]: true,

    [Symbol(kNeedDrain)]: false,

    [Symbol(corked)]: 0,

    [Symbol(kOutHeaders)]: [Object: null prototype] {

      accept: [Array],

      cookie: [Array],

      'user-agent': [Array],

      'accept-encoding': [Array],

      host: [Array]

    },

    [Symbol(kUniqueHeaders)]: null

  },

  response: {

    status: 404,

    statusText: 'Not Found',

    headers: AxiosHeaders {

      'cache-control': 'no-store, must-revalidate',

      'x-powered-by': 'Next.js',

      etag: '"96e-3UMFuq1OQMITCj8aIaMUGQiLzzU"',

      'content-type': 'text/html; charset=utf-8',

      vary: 'Accept-Encoding',

      date: 'Tue, 28 Feb 2023 17:16:27 GMT',

      connection: 'close',

      'transfer-encoding': 'chunked',

      [Symbol(defaults)]: null

    },

    config: {

      transitional: [Object],

      adapter: [Function: httpAdapter],

      transformRequest: [Array],

      transformResponse: [Array],

      timeout: 0,

      xsrfCookieName: 'XSRF-TOKEN',

      xsrfHeaderName: 'X-XSRF-TOKEN',

      maxContentLength: -1,

      maxBodyLength: -1,

      env: [Object],

      validateStatus: [Function: validateStatus],

      headers: [AxiosHeaders],

      baseURL: 'http://localhost:3060',

      withCredentials: true,

      method: 'get',

      url: '/user',

      data: undefined

    },

    request: <ref *1> ClientRequest {

      _events: [Object: null prototype],

      _eventsCount: 7,

      _maxListeners: undefined,

      outputData: [],

      outputSize: 0,

      writable: true,

      destroyed: true,

      _last: true,

      chunkedEncoding: false,

      shouldKeepAlive: false,

      maxRequestsOnConnectionReached: false,

      _defaultKeepAlive: true,

      useChunkedEncodingByDefault: false,

      sendDate: false,

      _removedConnection: false,

      _removedContLen: false,

      _removedTE: false,

      strictContentLength: false,

      _contentLength: 0,

      _hasBody: true,

      _trailer: '',

      finished: true,

      _headerSent: true,

      _closed: true,

      socket: [Socket],

      _header: 'GET /user HTTP/1.1\r\n' +

        'Accept: application/json, text/plain, /\r\n' +

        'Cookie: \r\n' +

        'User-Agent: axios/1.1.2\r\n' +

        'Accept-Encoding: gzip, deflate, br\r\n' +

        'Host: localhost:3060\r\n' +

        'Connection: close\r\n' +

        '\r\n',

      _keepAliveTimeout: 0,

      _onPendingData: [Function: nop],

      agent: [Agent],

      socketPath: undefined,

      method: 'GET',

      maxHeaderSize: undefined,

      insecureHTTPParser: undefined,

      path: '/user',

      _ended: true,

      res: [IncomingMessage],

      aborted: false,

      timeoutCb: null,

      upgradeOrConnect: false,

      parser: null,

      maxHeadersCount: null,

      reusedSocket: false,

      host: 'localhost',

      protocol: 'http:',

      _redirectable: [Writable],

<h2 style="font-size:14px;font-weight:normal;line-height:inherit;margin:0;padding:0">An unexpected error has occurred<!-- -->.</h2></div></div></div></div><script src="/_next/static/chunks/react-refresh.js?ts=1677604587296"></script><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{},"buildId":"development","isFallback":false,"gip":true,"head":[["meta",{"name":"viewport","content":"width=device-width"}],["meta",{"charSet":"utf-8"}],["title",{"children":": An unexpected error has occurred"}]]}</script><script nomodule="" src="/_next/static/chunks/polyfills.js?ts=1677604587296"></script><script src="/_next/static/chunks/main.js?ts=1677604587296"></script><script src="/_next/static/chunks/webpack.js?ts=1677604587296"></script><script src="/_next/static/chunks/pages/_app.js?ts=1677604587296"></script><script src="/_next/static/development/_buildManifest.js?ts=1677604587296"></script><script src="/_next/static/development/_ssgManifest.js?ts=1677604587296"></script></body></html>'  }}

무한 콘솔창 뜨는거 중간에 강제로 끊었습니다

 

 

back-json

front-json

app.js

const express = require('express');
const cors = require('cors');
const session = require('express-session');
const cookieParser = require('cookie-parser');
const passport = require('passport');
const dotenv = require('dotenv');
const morgan = require('morgan');
const path = require('path');
const hpp = require('hpp');
const helmet = require('helmet');

const postRouter = require('./routes/post');
const postsRouter = require('./routes/posts');
const userRouter = require('./routes/user');
const hashtagRouter = require('./routes/hashtag');
const db = require('./models');
const passportConfig = require('./passport');

dotenv.config();
const app = express();

db.sequelize.sync()
    .then(() => {
        console.log('db 연결 성공');
    })
    .catch(console.error);

    passportConfig();

    if (process.env.NODE_ENV === 'production') {
        app.use(morgan('combined'));
        app.use(hpp());
        app.use(helmet());
    } else {
        app.use(morgan('dev'));
    }

    app.use(cors({
        origin: ['http://localhost:3060', 'nodebird.com'],
        credentials: true // cookie 전달
    }));
    app.use('/', express.static(path.join(__dirname, 'uploads')));
    app.use(express.json()); // 
    app.use(express.urlencoded({ extended: true })); 
    app.use(cookieParser('nodebirdsecret'));
    app.use(session());
    app.use(passport.initialize());
    app.use(passport.session({
        saveUninitialized: false,
        resave: false,
        secret: process.env.COOKIE_SECRET
    }));

   app.get('/', (req, res) => {
        res.send('hello express');
   });

   app.use('/posts', postsRouter);
   app.use('/post', postRouter);
   app.use('/user', userRouter);
   app.use('/hashtag', hashtagRouter);

   app.listen(3065, () => {
       console.log('서버 실행중!');
   });

 

이전에 했던거 되돌리고싶어요

백엔드까지 했던곳으로 되돌리고 다시하고 싶은데 로그인하면 이렇게 무한로딩 되면서 이상한 콘솔창 무한으로 뜹니다

 

서버 에러 같은데 어딘지 모르겠습니다

port ? 404 에러 , asios 에러 ?

로그인 안되는데 찾을수가 없습니다

답변 1

0

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

엉뚱한 데를 보고 계신 것 같은데요. 백엔드 서버 콘솔에 에러메시지가 있을 겁니다. 백엔드 서버는 켜셨죠?

그리고 지금 요청 주소가 /user/login/posts라는 없는 주소입니다.

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

백엔드서버 켰어요

백엔드서버 콘솔에 연결성공만 뜨고 아무것도 안떠요

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

네 주소 틀린 것부터 수정하시고 백엔드 도메인 제대로 적혀있는지도 확인하세요.

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

찾았습니다.

감사합니다

br님의 프로필 이미지
br

작성한 질문수

질문하기