#Facing this issue in production caused by an internal dependency Next uses

32 messages · Page 1 of 1 (latest)

past spruce
#

Error
2|Frontend | TypeError: fetch failed
2|Frontend | at Object.fetch (node:internal/deps/undici/undici:11372:11)
2|Frontend | at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
2|Frontend | cause: _ConnectTimeoutError: Connect Timeout Error
2|Frontend | at onConnectTimeout (node:internal/deps/undici/undici:6616:28)
2|Frontend | at node:internal/deps/undici/undici:6574:50
2|Frontend | at Immediate._onImmediate (node:internal/deps/undici/undici:6605:13)
2|Frontend | at process.processImmediate (node:internal/timers:478:21)
2|Frontend | at process.callbackTrampoline (node:internal/async_hooks:130:17) {
2|Frontend | code: 'UND_ERR_CONNECT_TIMEOUT'
2|Frontend | },
2|Frontend | digest: '3747308182'
2|Frontend | }

We are running Next.js version 14.2.3 with Node 20.8.1

We have tried various solutions posted on github issues, and on discord but seem to find no luck to solve this error. If anyone knows any specific versions of Next where it isn't happening, pls let us know!

This is an ongoing issue and is impacting a lot of our live users in production as they are unable to use the App

Plus this was working fine before the POST

celest impBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

subtle viper
past spruce
#

Yes, we have verified from our BE and everything seems to be working fine locally too

past spruce
subtle viper
#

is it intermittent or is it breaking for all users?

past spruce
#

for all users

#

we found that it is due to undici dependency used by Next

simple prawn
#

I am experiencing this same issue. I was able to identify the issue for the first time yesterday. After every new deploy, many of my functions (which previously worked fine within 1 or 2 seconds) are timing out...

#

@past spruce how did you fix this?

past spruce
crisp belfry
#

i have this issue in development

#

didnot checked on deployement

#

what node version u using

#

in deployment

#
FROM node:22 AS base
FROM base AS deps
RUN npm install -g pnpm
WORKDIR /app

COPY package.json pnpm-lock.yaml ./
COPY prisma ./prisma
COPY schema.zmodel ./
RUN pnpm install --frozen-lockfile --prefer-frozen-lockfile

FROM base AS builder
RUN npm install -g pnpm

WORKDIR /app

COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN pnpm build

FROM base AS runner

ENV NODE_ENV production
ENV NEXT_TELEMETRY_DISABLED 1

COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
COPY --from=builder --chown=nextjs:nodejs /app/public ./public

RUN groupadd -r appuser && useradd -r -g appuser appuser

RUN chown -R appuser:appuser .next

USER appuser

CMD ["node", "server.js"]

#

this is my docker file

past spruce
#

We r using v20 for node

#

@scenic vault if this could be fast tracked, would much appreciate it

subtle viper
# past spruce for all users

how did it start happening? via a version upgrade, via a deployment, or just out of the blue? pretty rare that it would happen out of the blue, but from the error my only guess is that your next app has troubles connecting to your backend.

worthy valeBOT
past spruce
subtle viper
#

if it doesn't help, i'm honestly out of ideas. things are not known to just break down out of the blue

#

even if there was some critical bugs affecting the app, it typically only materialises after a commit or a new deployment

past spruce
#

I bumped the app to next canary 14.3.0 and it started working but just seems temporary tbh

#

But if you take a look at Google several people fixed this by either going back to specific versions or in some other hacky ways

https://medium.com/@kaloyan_17221/fix-vercel-next-js-fetch-failed-from-undici-polyfill-8c66346c9c2f

https://medium.com/@pawanjotkaurbaweja/solved-typeerror-fetch-failed-4f7d304c0c68

Medium

If you’ve been using Vercel + Next.JS recently, you might have come across a bug where the “fetch” will fail only on Vercel deployments…

subtle viper
#

yeah this bug i have never heard of or seen it, so no clues what it even means, sorry

past spruce
#

Thanks man for your input! Hopefully it would be fixed in the upcoming next release

simple prawn
#

@past spruce have you had issues since moving to 14.3.0?

kind void
#

Something had to have caused the issue, whether thans a operating sytem update, nodejs update, next update, SOMETHING is the culprit. Theres no way multiple people are running into the same issue 'all of a sudden' without some specific cause. It would be beneficial to retrace your steps and backout any changes made till you find what the issue is.