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.