FrontendOct 17, 20231 min readUpdated Dec 7, 2023

Next.js 13 TypeError: ???.getSetCookie is not a function 문제 해결하기

하루종일 Webstorm을 잡고 Next.js 버전 문제, 쿠키 모듈 수정 등 여러가지 시도를 해봤으나 답을 알 수 없는 상황에서 오늘 올라온 스택 오버플로우의 질문과 답변으로 해결됐다.

Author

Younggun Park

Frontend engineer and builder · Seoul, South Korea

I'm building Vision AI products at P2ACH AI, writing about frontend systems, AI tooling, and the quiet parts of shipping.

TL;DR

하루종일 Webstorm을 잡고 Next.js 버전 문제, 쿠키 모듈 수정 등 여러가지 시도를 해봤으나 답을 알 수 없는 상황에서 오늘 올라온 스택 오버플로우의 질문과 답변으로 해결됐다.

On this page

TypeScript

TypeError: responseHeaders.getSetCookie is not a function
    at new ResponseCookies (webpack-internal:///(app-metadata-route)/./node_modules/next/dist/compiled/@edge-runtime/cookies/index.js:213:47)
    at new NextResponse (webpack-internal:///(app-metadata-route)/./node_modules/next/dist/server/web/spec-extension/response.js:40:22)
    at GET (webpack-internal:///(app-metadata-route)/./node_modules/next/dist/build/webpack/loaders/next-metadata-route-loader.js?page=%2Ffavicon.ico%2Froute&isDynamic=0!./src/app/favicon.ico?__next_metadata_route__:15:10)

오늘 갑자기 코드에서 무진장 에러가 곳곳에서 떴다.

특히 서버 컴포넌트를 사용하는 쪽에서 getSetCookie 이슈가 발생했다.

하루종일 Webstorm을 잡고 Next.js 버전 문제, 쿠키 모듈 수정 등 여러가지 시도를 해봤으나 답을 알 수 없는 상황에서 오늘 올라온 스택 오버플로우의 질문과 답변으로 해결됐다.

Solution(해결방안)

I got same error with Node 18.12.1 and next ==13.5.5. And it disappeared with next ==13.5.4 or with Node 18.18.2.

Node.js 버전 문제로 보인다. 노드 버전 18.18.2에서 문제가 해결됐다.

reference

https://stackoverflow.com/questions/77304623/nextjs-typeerror

FAQ

Common follow-up questions

이 글의 핵심은 무엇인가요?
하루종일 Webstorm을 잡고 Next.js 버전 문제, 쿠키 모듈 수정 등 여러가지 시도를 해봤으나 답을 알 수 없는 상황에서 오늘 올라온 스택 오버플로우의 질문과 답변으로 해결됐다.
실무적으로 먼저 볼 포인트는 무엇인가요?
I got same error with Node 18.12.1 and next ==13.5.5. And it disappeared with next ==13.5.4 or with Node 18.18.2.

Tags

Next.jsSolution

Related posts

View all writing