• 카테고리

    질문 & 답변
  • 세부 분야

    풀스택

  • 해결 여부

    미해결

ERR_CONTENT_LENGTH_MISMATCH (200) OK 질문...

20.03.02 18:05 작성 조회수 1.09k

0

안녕하세요 계속 헤메다가 해결이 안되서 혹시 답을 얻을 수 있을까 하고 질문을 남겨봅니다..

댓글에 사용자 태그 기능을 추가하여 알림과 메일이 전송되게 구현을 해놓았는데요,
알림과 메일 필요한 유저를 배열로 만들고 await Promise.all 을 사용하여 전송을 하고 있으며 없는 경우에는 실행 되지 않도록 구현을 해놓았습니다.

POST https://mysite/api/post/120/comment net::ERR_CONTENT_LENGTH_MISMATCH 200 (OK)

그런데 잘 되던게 갑자기 이런 에러가 뜨면서 댓글이 정상적으로 실행이 되지를 않습니다...  웃긴건 await Promise.all  이 부분으 실행되지 않는 조건(태그를 하지 않는 경우)에는 에러가 뜨지 않는다는 것 인데... 저 부분이 어떤 문제가 있는건지도 모르겠습니다...
일단 제 생각에는 ssl 인증서 재발급 후에 이러는 것 같습니다...

const result = await Promise.all(userTags.map(user => {
      if(myFollowings.indexOf(user.slice(1)) !== -1){
             const userInfo = myInfo.Followings.filter(item => item.nickname === user.slice(1));
             setUserNotice('commentTag', userInfo[0].id, req.user.id, {post: post.id, comment: newComment.id})(req, res, next);
      }
}))

위의 코드는 댓글에  사용자를 태그했을 때 실행되는 코드인데 이게 서버에 무리가 가는 걸까요?...

keepAliveTimeout, headersTimeout, timeout 세가지 모두 추가해도 그대로 이구요
도무지 감이 잡히질 않습니다...

    1. Request URL:
      https://mysite/api/post/120/comment
    2. Request Method:
      POST
    3. Status Code:
      <slot style="min-width:0px;min-height:0px;box-sizing:border-box"></slot>
      200 OK
    4. Remote Address:
      13.124.165.254:443
    5. Referrer Policy:
      no-referrer-when-downgrade
  1. Response Headersview source
    1. Access-Control-Allow-Credentials:
      true
    2. Access-Control-Allow-Origin:
      https://mysite
    3. Connection:
      keep-alive
    4. Content-Length:
      212
    5. Content-Type:
      application/json; charset=utf-8
    6. Date:
      Mon, 02 Mar 2020 08:39:12 GMT
    7. ETag:
      W/"d4-g/sWJg6ANI7TEqjpFuTAtRFashk"
    8. Strict-Transport-Security:
      max-age=15552000; includeSubDomains
    9. Vary:
      Origin
    10. X-Content-Type-Options:
      nosniff
    11. X-DNS-Prefetch-Control:
      off
    12. X-Download-Options:
      noopen
    13. X-Frame-Options:
      SAMEORIGIN
    14. X-XSS-Protection:
      1; mode=block
  2. Request Headersview source
    1. Accept:
      application/json, text/plain, */*
    2. Accept-Encoding:
      gzip, deflate, br
    3. Accept-Language:
      ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7,zh;q=0.6
    4. Cache-Control:
      no-cache
    5. Connection:
      keep-alive
    6. Content-Length:
      48
    7. Content-Type:
      application/json;charset=UTF-8
    8. Cookie:
      _ga=GA1.2.2090723928.1582685579; _gid=GA1.2.986938525.1583125567; WkOiN=s%3An_TAEfPSNoVlE17UAH325RRrni4k3etX.Pq0S0kA9HUrMxJZaZAkDphlsG1%2B623074ZUa4t%2B42Cw; _gat_gtag_UA_154908530_1=1
    9. Host:
      api.blory.net
    10. Origin:
      https://blory.net
    11. Pragma:
      no-cache
    12. Referer:
      https://blory.net/view/1YQdJZodOG
    13. Sec-Fetch-Dest:
      empty
    14. Sec-Fetch-Mode:
      cors
    15. Sec-Fetch-Site:
      same-site
    16. User-Agent:
      Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36
  3. Request Payloadview source
    1. <slot style="min-width:0px;min-height:0px;box-sizing:border-box">{postId: 120, content: "@BLORY ", type: "view"}</slot>
      1. postId120
      2. content"@BLORY "
      3. type"view"

답변 1

답변을 작성해보세요.

0

Promise.all(userTags.map을 하시는 이유를 잘 모르겠습니다.

map 함수를 쓰려면 return을 하셔야하는데 return이 없습니다. 그리고 map 함수 안에서 req, res, next를 쓰시는 것도 위험합니다.