Skip to content

Serverless function being created when none of my pages use getInitialProps or getServerSideProps #30255

@rodilo

Description

@rodilo

What version of Next.js are you using?

11.1.2

What version of Node.js are you using?

14.17.6

What browser are you using?

Chrome

What operating system are you using?

macOS

How are you deploying your application?

Vercel

Describe the Bug

After upgrading to next 11, we build times went crazy for our app. In the logs, I see that creating serverless functions is being done, even though we don't have any getInitialProps or getServerSideProps, only getStaticProps.


09:48:25.794 | Done in 225.86s.
09:48:28.652 | Traced Next.js server files in: 2.474s
09:55:55.351 | Created all serverless functions in: 7:26.697 (m:ss.mmm)
09:55:57.857 | Uploading build outputs...
09:56:04.314 | Deploying build outputs...
09:56:47.123 | Build completed. Populating build cache...


After some debugging, I've come to the conclusion that this is only happening if you have localization enabled (we have 3 locales).

I've played around with the nextjs version, and if I use v10, this part

09:55:55.351 | Created all serverless functions in: 7:26.697 (m:ss.mmm)

is skipped.

Expected Behavior

I expect that if none of the pages use getInitialProps or getServerSideProps this part of the build should be skipped:

09:48:28.652 | Traced Next.js server files in: 2.474s
09:55:55.351 | Created all serverless functions in: 7:26.697 (m:ss.mmm)

To Reproduce

Since our repo is private, I've created some example repo so you can test it out:
https://github.com/rodilo/next-18n-build-test

of course, since this app is lot smaller (only 2 pages) then our app, creating of serverless functions part of the build is done much faster.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue was opened via the bug report template.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions