[NEXT-1190] TypeError: fetch failed in server componant since next 13.0.6
Problem
Verify canary release - [X] I verified that the issue exists in the latest Next.js canary release Provide environment information Operating System: Platform: linux Arch: x64 Version: #62-Ubuntu SMP Tue Nov 22 19:54:14 UTC 2022 Binaries: Node: 18.12.0 npm: 8.19.2 Yarn: 1.22.19 pnpm: N/A Relevant packages: next: 13.0.6 eslint-config-next: 13.0.0 react: 18.2.0 react-dom: 18.2.0 Which area(s) of Next.js are affected? (leave empty if unsure) Data fetching (gS(S)P, getInitialProps) Link to the code that reproduces this issue https://github.com/sylvain-guehria/StockShop To Reproduce I log here : https://inventory-market.vercel.app/ and that it's Describe the Bug when I log, a server componant fetch data. This was working this morning but after installing next 13.0.6 I got this error only in prod : error validating user TypeError: fetch failed at Object.fetch (/var/task/node_modules/next/dist/compiled/undici/index.js:1:26684) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async validateUser (/var/task/.next/server/app/page.js:740:21) at async HomePage (/var/task/.next/server/app/page.js:674:17) { cause: TypeError: Cannot read properties of undefined (reading 'reason') at makeAppropriateNetworkError (/var/task/node_modules/next/dist/compiled/undici/index.js:2:54604) at schemeFetch (/var/task/node_modules/next/dist/compiled/undici/index.js:2:3000
Error Output
error only in prod :
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Solution: [NEXT-1190] TypeError: fetch failed in server componant since next 13.0.6
I managed to solve this problem by using 127.0.0.1 instead of localhost in the fetch URL
Trust Score
7 verifications
- 1
I managed to solve this problem by using 127.0.0.1 instead of localhost in the f
I managed to solve this problem by using 127.0.0.1 instead of localhost in the fetch URL
Validation
Resolved in vercel/next.js GitHub issue #44062. Community reactions: 39 upvotes.
Verification Summary
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep