Deploy fails after upgrading Netlify CLI from v24 to v26: ___netlify-server-handler exceeds 250 MB

Hi Netlify Support,

We’re seeing a deploy-preview failure only after upgrading Netlify CLI from v24 to v26. The same Next.js/Nx monorepo deploy flow worked before the CLI upgrade.

Netlify site:

  • Site name: <site>.netlify.app

  • Deploy preview: pr-<number>--<site>.netlify.app

  • Custom domain: N/A for this deploy-preview issue

Project context:

  • Framework: Next.js 15 / Nx monorepo

  • Netlify adapter/plugin in logs: @netlify/plugin-nextjs@5.15.11

  • Deploy flow: GitHub Actions using Netlify CLI

  • Deploy context: deploy-preview

  • Build command: nx build <next-app>

  • Publish directory: apps/<next-app>/.next

Deploy command:

npx netlify-cli deploy \

--build \

--dir apps/<next-app>/.next \

--alias pr-<number> --context=deploy-preview \

--message "Deployed from GitHub Actions with build tag <commit-sha>" \

--filter <next-app>

Failure excerpt:

Packaging Edge Functions from apps/<next-app>/.netlify/edge-functions directory:

 - ___netlify-edge-handler-src-middleware

Deploy path:        /home/runner/_work/<repo>/<repo>/apps/<next-app>/.next

Functions path:     /home/runner/_work/<repo>/<repo>/apps/<legacy-app>/netlify/functions

Configuration path: /home/runner/_work/<repo>/<repo>/apps/<next-app>/netlify.toml

Functions folder "/home/runner/_work/<repo>/<repo>/apps/<legacy-app>/netlify/functions" specified but it doesn't exist! Will proceed without deploying functions

✔ Deploying functions from cache (use --skip-functions-cache to override)

✔ Finished hashing 745 files, 1 functions and edge functions

✔ CDN requesting 20 files and 1 functions

⠋ Uploading 21 files

 ›   Warning: JSONHTTPError: The function exceeds the maximum size of 250 MB 400

Internal error during "options.onPostBuild"

Error message

JSONHTTPError: Bad Request

Error location

During options.onPostBuild

  at parseResponse (.../node_modules/@netlify/api/lib/methods/response.js:34:39)

  at async tryUpload (.../node_modules/netlify-cli/dist/utils/deploy/upload-files.js:80:29)

Error properties

{

  name: 'JSONHTTPError',

  status: 400,

  json: {

    code: 400,

    message: 'The function exceeds the maximum size of 250 MB'

  }

}
  • This is not a DNS/custom-domain issue.
  • We already tried Ask Netlify, but it did not provide a clear actionable suggestion.

We suspect the underlying issue is that development dependencies from the monorepo/root node_modules are being included in the generated Next.js server function bundle. The Netlify CLI v24 → v26 upgrade may simply have increased the dev dependency footprint enough for ___netlify-server-handler to exceed the 250 MB limit.

If that assessment is correct, what is the supported way to prevent dev dependencies from being packaged into the Netlify-generated Next.js server function for a Next.js 15 / Nx monorepo? We’d also appreciate guidance on how to inspect the generated function bundle contents to confirm which dependencies are being included.

Hey @san.saelek :wave:,
Thanks for reaching out!

We’ve gone ahead and created a support ticket for you, so our team can follow up with you directly via email from the help desk. Our Support crew will be in touch with you by email soon.

Great news: these days anyone can reach out to Netlify Support. First, you can try getting an answer using Ask Netlify, our helpful AI search tool. If your question isn’t answered there, you can submit a ticket using the support form, and we’ll take it from there.

We’re keeping the community around for swapping ideas, sharing tips and tricks, and talking shop with other folks building on the platform — but for support issues, tickets are the way to go.

Thanks for being here, and keep an eye out for that email from us!