Next.js deploy hangs after functions deploy

We have Next.js site, with huge using of getInitialProps. But after successful building it hangs at functions bundling:

10:29:46 PM:  - next_vacancies_create_tariffId/next_vacancies_create_tariffId.js
10:29:46 PM:  - next_vacancies_vacancyId/next_vacancies_vacancyId.js
10:29:46 PM:  - next_vacancies_vacancyId_candidates/next_vacancies_vacancyId_candidates.js
10:29:46 PM:  - next_vacancies_vacancyId_edit/next_vacancies_vacancyId_edit.js
10:29:46 PM:  - next_vacancy_vacancyId/next_vacancy_vacancyId.js
10:29:46 PM:  - next_verifyemail/next_verifyemail.js
10:29:46 PM: ​
10:41:52 PM: Canceling deploy <<<< We had to stop deploy because of using our build minuts
10:41:54 PM: Uncaught exception, the process will now terminate…
10:41:54 PM: Error: ENOENT: no such file or directory, open '/opt/build/repo/node_modules/encoding/node_modules/iconv-lite/encodings/sbcs-data-generated.js'
10:41:54 PM: Execution timed out after 20m10.820050141s
10:41:54 PM: Error running command: Command did not finish within the time limit
10:41:54 PM: Failing build: Failed to build site
10:41:54 PM: Finished processing build request in 20m16.174590662s

Full log

Welcome to the forums @vitalybaev

This line

and this line

tell the story. Your build took longer than the 15min allotted by default.

Check out [Support Guide] How can I optimize my Netlify build time?, [Support Guide] How long should Netlify builds take?, and [Support Guide] Build Performance Pro-tips on trying to reduce the time it takes to build.

If you still have no luck, then you can request an increase in your build time.

1 Like

But why build doesn’t stop automatically?
I think we have to request to increase build time, because we’ve done almost all tasks to speed up our build.

It turned out that build was ok. I have to wait about 15 minutes after last function’s name appears in the log.

1 Like

Thanks for coming back and letting us know, @vitalybaev. Glad everything is working for you! :netliconfetti: