# v0 on Debugging the ISR deployment problem
# Question
When trying to deploy your example to Vercel, I've got an error:
A Serverless Function has exceeded the unzipped maximum size of 250 MB
Here is the full log:
[22:08:47.803] Running build in Washington, D.C., USA (East) – iad1
[22:08:47.952] Retrieving list of deployment files...
[22:08:48.490] Downloading 82 deployment files...
[22:08:56.216] Restored build cache from previous deployment (7F4PndeqLFxgk3LvtijPYy8SHo7r)
[22:08:56.342] Running "vercel build"
[22:08:57.553] Vercel CLI 39.2.0
[22:08:58.244] Detected `pnpm-lock.yaml` version 9 generated by pnpm@9.x
[22:08:58.268] Installing dependencies...
[22:08:59.269] Lockfile is up to date, resolution step is skipped
[22:08:59.419] Already up to date
[22:08:59.907]
[22:08:59.922] Done in 1.5s
[22:08:59.946] Detected Next.js version: 15.0.2
[22:08:59.964] Running "pnpm run build"
[22:09:00.767]
[22:09:00.767] > nextra-docs-template@1.0.0 build /vercel/path0
[22:09:00.768] > next build
[22:09:00.768]
[22:09:02.981] ▲ Next.js 15.0.2
[22:09:02.982]
[22:09:03.105] Creating an optimized production build ...
[22:09:08.033] - [33mwarn[0m [nextra] Init git repository failed Discover git repo from [/vercel/path0] failed: could not find repository at '/vercel/path0'; class=Repository (6); code=NotFound (-3)
[22:10:11.317] ✓ Compiled successfully
[22:10:11.324] Linting and checking validity of types ...
[22:10:11.530] Collecting page data ...
[22:10:15.055] Generating static pages (0/41) ...
[22:10:18.778] Generating static pages (10/41)
[22:10:18.779] Generating static pages (20/41)
[22:10:32.622] Generating static pages (30/41)
[22:10:32.624] ✓ Generating static pages (41/41)
[22:10:32.624] /vercel/path0/data
[22:10:32.624] ""
[22:10:32.625] ""
[22:10:41.931] Finalizing page optimization ...
[22:10:41.933] Collecting build traces ...
[22:11:08.810]
[22:11:08.826] Route (app) Size First Load JS
[22:11:08.826] ┌ ○ /_not-found 897 B 101 kB
[22:11:08.826] └ ● /blog/[id] 137 B 99.9 kB
[22:11:08.827] ├ /blog/1
[22:11:08.827] ├ /blog/2
[22:11:08.827] ├ /blog/3
[22:11:08.827] └ [+7 more paths]
[22:11:08.828] + First Load JS shared by all 99.7 kB
[22:11:08.828] ├ chunks/3940710d-8bc0c1562b0390ff.js 52.6 kB
[22:11:08.828] ├ chunks/610-44c9479a9ebc9a86.js 45.2 kB
[22:11:08.828] └ other shared chunks (total) 1.94 kB
[22:11:08.829]
[22:11:08.829] Route (pages) Size First Load JS
[22:11:08.829] ┌ ○ / (533 ms) 2.9 kB 167 kB
[22:11:08.832] ├ /_app 0 B 160 kB
[22:11:08.834] ├ ● /_meta 249 B 160 kB
[22:11:08.834] ├ ○ /404 (811 ms) 1.61 kB 166 kB
[22:11:08.834] ├ ○ /advanced (806 ms) 1.61 kB 166 kB
[22:11:08.834] ├ ● /advanced/_meta 256 B 160 kB
[22:11:08.834] ├ ○ /advanced/accesing-config (805 ms) 3.17 kB 167 kB
[22:11:08.834] ├ └ css/3d60d0aceaeb37d9.css 122 B
[22:11:08.836] ├ ○ /advanced/at-alias (805 ms) 2.54 kB 167 kB
[22:11:08.836] ├ ƒ /api/auth/[...nextauth] 0 B 160 kB
[22:11:08.836] ├ ƒ /api/github-repos/[username] 0 B 160 kB
[22:11:08.837] ├ ƒ /api/restricted 0 B 160 kB
[22:11:08.837] ├ ● /auth/_meta 251 B 160 kB
[22:11:08.837] ├ ○ /auth/login (804 ms) 1.92 kB 166 kB
[22:11:08.837] ├ ○ /auth/restricted (805 ms) 2.31 kB 166 kB
[22:11:08.837] ├ ○ /clientComponent (804 ms) 2.91 kB 167 kB
[22:11:08.837] ├ ○ /clientSideProtectedExample (535 ms) 2.29 kB 166 kB
[22:11:08.838] ├ ƒ /clientSideProtectedExampleDynamicPage 2.89 kB 171 kB
[22:11:08.838] ├ ○ /code (533 ms) 1.98 kB 166 kB
[22:11:08.838] ├ ● /context 1.61 kB 166 kB
[22:11:08.838] ├ ƒ /dynamic-mdx 2.33 kB 171 kB
[22:11:08.838] ├ ƒ /dynamic-post-building 2.33 kB 171 kB
[22:11:08.838] ├ ● /dynamic-post-building-getstaticprops (14387 ms) 2.34 kB 171 kB
[22:11:08.838] ├ ● /FileReader 1.92 kB 166 kB
[22:11:08.839] ├ ● /get-static-props (ISR: 60 Seconds) (623 ms) 2.81 kB 167 kB
[22:11:08.839] ├ ● /get-static-props-readfile 1.91 kB 166 kB
[22:11:08.839] ├ ○ /intro-to-components (532 ms) 3.13 kB 167 kB
[22:11:08.839] ├ └ css/a0786626dbb3c2b6.css 105 B
[22:11:08.839] ├ ○ /ISR (807 ms) 5.27 kB 169 kB
[22:11:08.840] ├ ○ /live (532 ms) 87.6 kB 252 kB
[22:11:08.840] ├ ○ /passinginfo (532 ms) 2 kB 166 kB
[22:11:08.840] ├ ● /posts/[id] (1871 ms) 662 B 160 kB
[22:11:08.840] ├ └ css/096e8b2b15818a7e.css 575 B
[22:11:08.840] ├ ├ /posts/2024-12-08-leccion (625 ms)
[22:11:08.841] ├ └ /posts/2024-12-09-leccion (624 ms)
[22:11:08.841] ├ ○ /protected/secret (528 ms) 2.24 kB 166 kB
[22:11:08.841] ├ ● /readFile (561 ms) 1.57 kB 166 kB
[22:11:08.841] ├ ƒ /serverSideProtectedExample 416 B 160 kB
[22:11:08.841] ├ ○ /swr (663 ms) 3.31 kB 172 kB
[22:11:08.842] ├ ƒ /user/[username] 803 B 160 kB
[22:11:08.842] └ ○ /userRepos 2.52 kB 167 kB
[22:11:08.842] └ css/42ff6ee1a7e6fab4.css 625 B
[22:11:08.842] + First Load JS shared by all 174 kB
[22:11:08.843] ├ chunks/framework-415c6982541a665e.js 44.8 kB
[22:11:08.843] ├ chunks/main-586ee97ea7b75755.js 37.9 kB
[22:11:08.843] ├ chunks/pages/_app-d04133c3a4c78923.js 75.2 kB
[22:11:08.843] ├ css/396771fc71f5a51c.css 14.7 kB
[22:11:08.844] └ other shared chunks (total) 1.74 kB
[22:11:08.844]
[22:11:08.847] ƒ Middleware 57.4 kB
[22:11:08.848]
[22:11:08.848] ○ (Static) prerendered as static content
[22:11:08.849] ● (SSG) prerendered as static HTML (uses generateStaticParams)
[22:11:08.849] (ISR) incremental static regeneration (uses revalidate in generateStaticParams)
[22:11:08.849] ƒ (Dynamic) server-rendered on demand
[22:11:08.849]
[22:11:09.252] Traced Next.js server files in: 200.149ms
[22:11:13.088] Warning: Max serverless function size of 250 MB uncompressed reached
[22:11:13.089] Serverless Function's page: FileReader.js
[22:11:13.093] Large Dependencies Uncompressed size
[22:11:13.093] .next/cache/webpack 279.42 MB
[22:11:13.093] node_modules/.pnpm/next@15.0.2_react-dom@18.3.1_react@18.3.1__react@18.3.1 8.08 MB
[22:11:13.094] node_modules/.pnpm/react-dom@18.3.1_react@18.3.1 1.64 MB
[22:11:13.094] .github/screenshot.png 867.74 KB
[22:11:13.096] .next/trace 746.51 KB
[22:11:13.096]
[22:11:13.097] All dependencies 284.38 MB
[22:11:13.097] Max serverless function size was exceeded for 1 function
[22:11:13.165] Created all serverless functions in: 3.907s
[22:11:13.263] Collected static files (public/, static/, .next/static): 26.67ms
[22:11:13.446] Build Completed in /vercel/output [2m]
[22:11:13.850] Deploying outputs...
[22:11:32.077] Error: A Serverless Function has exceeded the unzipped maximum size of 250 MB. : https://vercel.link/serverless-function-size
[22:11:34.473]
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
What is your diagnostic?
# Answer
DANGER
The error you're encountering is due to the size of your serverless function exceeding Vercel's limit of 250 MB uncompressed. This is a common issue when deploying large Next.js applications to Vercel. Let's break down the problem and provide some solutions:
- Excessive Build Cache:
The log shows that
.next/cache/webpack
is taking up 279.42 MB, which is the main culprit for exceeding the size limit. - Large Dependencies:
While not the primary issue here, your
node_modules
folder is also contributing to the size. - Static Assets:
There's a large screenshot file (
.github/screenshot.png
) that's being included in the deployment.
To resolve this issue, you can try the following steps:
- Clear Build Cache:
Before deploying, try clearing the Next.js build cache. You can do this by adding a build command in your
package.json
:
"scripts": {
"vercel-build": "rm -rf .next && next build"
}
2
3
"scripts": {
"vercel-build": "rm -rf .next && next build"
}
2
3
Then in your Vercel project settings, change the build command to npm run vercel-build
or pnpm run vercel-build
(depending on your package manager).
- Optimize Dependencies:
Review your dependencies and remove any that aren't necessary for production. You can use
next/bundle-analyzer
to identify large dependencies. - Exclude Non-Essential Files:
Create a
.vercelignore
file in your project root to exclude files not needed in production, like the large screenshot:
.github
.github
- Use Output File Tracing:
Next.js 12 introduced output file tracing, which can significantly reduce the size of serverless functions. Ensure it's enabled in your
next.config.js
:
module.exports = {
experimental: {
outputFileTracingRoot: undefined, // undefined means it will use the package root
},
}
2
3
4
5
module.exports = {
experimental: {
outputFileTracingRoot: undefined, // undefined means it will use the package root
},
}
2
3
4
5
- Consider Using Edge Functions: If possible, convert some of your API routes to Edge Functions, which have different size limits.
- Split Your Application: If the application is still too large, consider splitting it into smaller sub-applications or using a monorepo structure.
After making these changes, try deploying again. If the issue persists, you might need to consider using a different deployment strategy, such as using Vercel's Edge Network or a traditional server deployment.
Let me know if you need help implementing any of these solutions or if you have any questions about this approach!