I have a project which has been autodeploying once a month using a hook using next 12.3 for 1-2 years. It looks like 1st of november 2023, it was totally fine, coming in at 23 minutes (I have thousands of pages being generated). 1st of december, all of a sudden the build time more than doubled, despite changing nothing on my EC2, and clearly seeing that a previous build using the same commit worked. Did something happen around december? e.g did the node-instances running the deploy-builds get slower? or perhaps did a node-update affect it? I’m not sure how to resolve it, as right now my builds are being blocked because they exceed 45 minutes. Reducing the amount of pages isn’t really an option for me, and I would like to stay at next 12 as of now. The increase in time seems to be happening when it’s generating static pages, making API-calls to my API (but like I said, my API remains the same version, EC2-instance same, basically I think I’ve confirmed it’s not on the backend)
Hi @tobeyforce!
Welcome to the Vercel Community
I’ve shared this internally and will get back to you on any findings. Can you also try and redeploy an older, faster commit so that we can rule out a code issue?
I did redeploy an old commit which worked multiple times, but it didn’t seem to help.
I confirmed that the problem isn’t on the backend, as I went ahead and massively upgraded my EC2 to have 8~ cores.
It really just seems like nextjs is generating the static pages extremly slowly, for some reason.
Right now I’ve tested adding the CPU-parameter, which actually seems to work as it looks like the workers are making more requests (previously according to my logs, my API is receiving about 2 requests/second, now around 4-5, which speeds it up as I increased CPU to 2:
experimental: {
esmExternals: false,
cpus: 2,
},
What’s even more strange is that I can tell that after the first build commit failed, it ended up working around 3-4 months later.
Perhaps it’s got something to do with the versions used in package.json:
{
"name": "frontend_veckonummer",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build && next-sitemap --config next-sitemap.config.js",
"start": "next start",
"next-sitemap": "next-sitemap",
"analyze": "cross-env ANALYZE=true next build",
"analyze:server": "cross-env BUNDLE_ANALYZE=server next build",
"analyze:browser": "cross-env BUNDLE_ANALYZE=browser next build"
},
"dependencies": {
"@headlessui/react": "^1.6.3",
"@heroicons/react": "^1.0.6",
"@material-tailwind/react": "^1.0.3",
"@next/bundle-analyzer": "^12.2.0",
"@svgr/webpack": "^6.2.1",
"axios": "^0.26.1",
"cross-env": "^7.0.3",
"date-fns": "^2.28.0",
"js-cookie": "^3.0.1",
"next": "12.3",
"next-plugin-preact": "^3.0.7",
"next-sitemap": "^3.0.4",
"next-themes": "^0.2.0",
"nprogress": "^0.2.0",
"preact": "^10.11.3",
"preact-render-to-string": "^6.5.0",
"react": "npm:@preact/compat@^17.1.1",
"react-dom": "npm:@preact/compat@^17.1.1",
"react-ssr-prepass": "npm:preact-ssr-prepass@^1.2.0",
"sharp": "^0.30.3"
},
"devDependencies": {
"autoprefixer": "^10.4.0",
"eslint": "latest",
"eslint-config-next": "latest",
"postcss": "^8.4.5",
"prettier": "^2.5.1",
"prettier-plugin-tailwindcss": "^0.1.1",
"sass": "^1.50.1",
"tailwindcss": "^3.0.7"
}
}
We had a look, and it seems like there is an issue with the Vercel CLI version.
Could you try to rebuild with an env var to use the CLI version from before the issue? You’d need to set this:
VERCEL_CLI_VERSION=vercel@32.4.1
You mean I should attempt to add this env locally in my dev environment, or in the Vercel .env-variables?
I added the .env but the speed slowed down again (since I removed the cpu:2 param from settings)
Here is the buildlog so far - I will cancel it:
[18:06:13.623] Running build in Washington, D.C., USA (East) – iad1
[18:06:13.774] Cloning github.com/Tobeyforce/veckonummer-frontend (Branch: main, Commit: 9d0c7c6)
[18:06:25.012] Cloning completed: 11.233s
[18:06:25.865] Restored build cache
[18:06:25.990] Warning: Using the VERCEL_CLI_VERSION
env var will opt-out of new features and bug fixes
[18:06:25.990] Installing Vercel CLI: vercel@32.4.1
[18:06:35.916] Running “vercel build”
[18:06:36.375] Vercel CLI 32.4.1
[18:06:36.840] Installing dependencies…
[18:06:39.310]
[18:06:39.311] up to date in 2s
[18:06:39.312]
[18:06:39.312] 189 packages are looking for funding
[18:06:39.312] run npm fund
for details
[18:06:39.323] Detected Next.js version: 12.3.4
[18:06:39.335] Detected package-lock.json
generated by npm 7+
[18:06:39.336] Running “npm run build”
[18:06:39.951]
[18:06:39.951] > build
[18:06:39.951] > next build && next-sitemap --config next-sitemap.config.js
[18:06:39.952]
[18:06:40.249] info - Loaded env from /vercel/path0/.env.production
[18:06:40.378] warn - You have enabled experimental feature (esmExternals) in next.config.js.
[18:06:40.379] warn - Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use at your own risk.
[18:06:40.379]
[18:06:40.698] info - Linting and checking validity of types…
[18:06:40.889] info - Creating an optimized production build…
[18:07:00.896] info - Compiled successfully
[18:07:00.897] info - Collecting page data…
[18:07:04.027] info - Generating static pages (0/4372)
[18:08:04.634] info - Generating static pages (83/4372)
[18:09:04.764] info - Generating static pages (160/4372)
[18:10:05.269] info - Generating static pages (238/4372)
Can you try redeploying the last build that wasn’t slow? This is to rule out a potential issue with your code, with the same CLI env var you used (i.e. vercel@32.4.1
)
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.