Next.js Discord

Discord Forum

Updated Node Package for Next 12 app.. now extremely long build times on deploy

Answered
Citrus blackfly parasitoid posted this in #help-forum
Open in Discord
Citrus blackfly parasitoidOP
Hey all! I am fairly new to this discord so apologies if I am not following any sort of protocol here. My team recently updated a number of our outdated packages for our app in Node and we have deployed them to our development environment that is hosted on Vercel. We went from a 2-3 minute build time for any deploy builds to 15-20 minute build times. I am somewhat new to Next.js/Vercel deployments and I was curious if there was a step that needs to take place up on Vercel so our build times are optimal again.

I have searched online for a case where someone had the same experience/issue but I seem to not be able to find any leads to a solution here. Help/guidance would be most appreciated. Thank you so much in advance!

-Emeri
Answered by Citrus blackfly parasitoid
so we found a package, when after being updated, was causing the massive resource drain on our builds. Thankfully it was a package that was not being utilized in the app and seemed to be technical debt from the team that initially built this thing.

@Dunker thanks again for the assist on this. It helped us get closer to a solution. Cheers bud!
View full answer

116 Replies

@Dunker what you were using so far
Citrus blackfly parasitoidOP
what do you mean?
Dunker
which tool was giving that 2-3 min build times
Citrus blackfly parasitoidOP
We push code to a Bitbucket repo, and it'll build/deploy to Vercel
Dunker
i mean was it next, react, any other
Citrus blackfly parasitoidOP
its a Next 12 application
Dunker
is it still next 12
Citrus blackfly parasitoidOP
yes
Dunker
so you updated some deps and build time increased
Citrus blackfly parasitoidOP
yeah
Dunker
are you having same issue at local build step
Citrus blackfly parasitoidOP
full deps list
let me run a local build
Dunker
first do these
remove .next, and npm cache clean --force
Citrus blackfly parasitoidOP
alrighty let me let this build run
then ill do that
this in root locally correct?
yeah locally it took like 2 mins like normal
but if I deploy this code up to my Bitbucket and it deploys to Vercel, it takes 15+ minutes
so should I delete .next and then run npm cache clean --force and then try a push?
sorry for the noob questions 😄
Citrus blackfly parasitoidOP
@Dunker
Dunker
first delete .next, run cache clean, and build locally
then tell me how much it took
Citrus blackfly parasitoidOP
doing that now
will do
Dunker
sometimes i am feeling like i picked wrong side 😂
Citrus blackfly parasitoidOP
haha
I like next a lot but we inherited a legacy next js project so we're unbuckling all the weirdness
this app sat untouched for 2 years and we needed to update deps for security reasons
Dunker
you havent seen next 13 yet 😄
Citrus blackfly parasitoidOP
haha
Dunker
i d prefer writing app totally with v13 scratch
and serious
Citrus blackfly parasitoidOP
yeah we may fork and rebuild in 13 at some point
our app isnt very big
Dunker
when i last time updated my deps, my all work was gone
Citrus blackfly parasitoidOP
oh no..
still rebuilding fyi..
Dunker
okay, just make sure that followed steps
dont deploy
Citrus blackfly parasitoidOP
ok
Dunker
we ll do one more step on t
Citrus blackfly parasitoidOP
still building
looks like this will be 15+ min build
ill let you know when it finishes
Dunker
yea brew a coffee while
Citrus blackfly parasitoidOP
lol I had my server running
shut it down and its moving forward
Dunker
ghosts
especially when its connected to priced services
Citrus blackfly parasitoidOP
alright it built
it got hung up because I was runing npm run dev
server was on
ok so whats next?
Dunker
are you seein a time
Citrus blackfly parasitoidOP
not seeing a timestamp for the run time for the build
in my terminal
I can redo the process of deleting .next and timing how long it takes to build
just to be sure
Dunker
look at build logs, it ll say build took .. . sec
also dont need to delete .next anymore
Citrus blackfly parasitoidOP
build output
no timestamps
it took maybe 5-8 minutes
Dunker
okay, now deploy to vercel and look at logs
Citrus blackfly parasitoidOP
will do
Dunker
there are timestamps
Citrus blackfly parasitoidOP
deploy started at 14:00
ill let you know when its done
still building...
5 minutes so far
Citrus blackfly parasitoidOP
past the ten minute mark lol
Dunker
they are saying we made things lot faster in v13
Citrus blackfly parasitoidOP
hmm
should we update react and next to latest versions?
this thing is still building fyi
Dunker
if you want some adventure
btw is your project open source
Citrus blackfly parasitoidOP
it is not
Dunker
also i d say my project has nearly 1/3 of pages and content of yours, and its taking mins to build
Citrus blackfly parasitoidOP
yeah its something in our packages thats holding it up
ill do some more research today
ill update this thread with what I find
I found this thread where someone was experiencing something similar
Dunker
probably your package json is around 100 line
Citrus blackfly parasitoidOP
it may be our sass package
Dunker
i mean i am using latest version, with 1/3 of your load, its still taking minutes
Citrus blackfly parasitoidOP
right
we dont want to update yet
we are in the middle of a release sprint
Dunker
but at build log everything red in your project
means your pages so big to bundle
Citrus blackfly parasitoidOP
what could cause that?
Dunker
large pages as LOC like 600
Citrus blackfly parasitoidOP
ok ill do some research and get back to you here
I need to get with my dev who did the work and ask some questions
thanks oldcoder!
Dunker
who started this chaos ' 😄
in short, its normal i d say
good luck
Citrus blackfly parasitoidOP
haha yeah my new developer did but its all good! I wouldve broken it too
thanks for all of the help and ill update this thread if we figure out what the root cause was
tomorrow should be fun!
Citrus blackfly parasitoidOP
so we found a package, when after being updated, was causing the massive resource drain on our builds. Thankfully it was a package that was not being utilized in the app and seemed to be technical debt from the team that initially built this thing.

@Dunker thanks again for the assist on this. It helped us get closer to a solution. Cheers bud!
Answer
Dunker
✅
Dunker
mark as solution
Citrus blackfly parasitoidOP
dumb question: how do I mark as answered?
figured it out!