Dev cuts Next.js CI/CD pipeline from 15 minutes to 4 by fixing artifact bloat
A developer discovered their Azure DevOps pipeline was packaging a 1.2 GB artifact — including full node_modules and source files — despite Next.js already generating a lean 24 MB standalone build directory. The fix involved updating the pipeline to copy only the .next/standalone folder into the deployment zip, shrinking the transferred artifact from 614 MB compressed down to 24 MB. This single change reduced the total pipeline runtime from roughly 15 minutes to about 4 minutes. The developer also added a dedicated /api/health route after finding health checks were hitting auth middleware and returning redirects instead of status responses. A separate cookie-naming bug that caused an infinite sign-in loop locally was resolved by basing the secure cookie prefix on the actual NEXTAUTH_URL protocol rather than NODE_ENV.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in