Repository navigation
Description
[REQUIRED] Environment info
When I try to deploy a next project, the pages marked as static by next build are given as reasons why cloud functions are needed (subsequently causing cold start delays rather than serving static pages from cdn).
firebase-tools: using 11.19.0 but tried others as well
Platform: Windows
[REQUIRED] Test case
[REQUIRED] Steps to reproduce
First I'm hoping someone can just clarify if I am misunderstanding something (see the actual behavior below).
[REQUIRED] Expected behavior
I expect cloud functions to only apply to the api routes and the server side rendered pages.
[REQUIRED] Actual behavior
I have a Next.js 12 project, with a page that has minimal stuff in it:
const Dashboards = () => {
return <div>This is the Dashboards page</div>;
};
export default Dashboards;
but then firebase deploy lists this as a reason why it needs cloud functions even though next.js lists this as a static page.
Route (pages) Size First Load JS
┌ /_app 0 B 349 kB
├ λ /[provider] 5.61 kB 355 kB
├ ○ /404 194 B 350 kB
├ λ /api/hello 0 B 349 kB
├ ○ /charts (657 ms) 73.3 kB 423 kB
├ ○ /dashboards 274 B 350 kB
├ ○ /our-approach 1.15 kB 351 kB
├ ○ /research 344 B 350 kB
├ ○ /search (1804 ms) 272 B 350 kB
├ ○ /security 1.37 kB 351 kB
└ ○ /user/settings 4.99 kB 354 kB
+ First Load JS shared by all 350 kB
├ chunks/framework-4556c45dd113b893.js 45.2 kB
├ chunks/main-d2fa5d94e1c1d6ef.js 31.3 kB
├ chunks/pages/_app-2bbab969a0265f20.js 271 kB
├ chunks/webpack-7366c3a031b580cf.js 1.88 kB
└ css/d25682aacd1f4b07.css 1.09 kB
λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)
○ (Static) automatically rendered as static HTML (uses no initial props)
Building a Cloud Function to run this application. This is needed due to:
• non-static route /api/hello
• non-static route /charts
• non-static route /dashboards
• non-static route /our-approach
• non-static route /research
• and 5 other reasons, use --debug to see more
I deleted the next.config.js file, tried different versions of firebase, downgraded next from 13 to 12 and eliminated other elements of next that I though might be contributing (like font optimization). I think there is something basic about firebase webframework deploy that I am not understanding.
Activity
google-oss-bot commentedon Apr 5, 2023
This issue does not have all the information required by the template. Looks like you forgot to fill out some sections. Please update the issue with more information.
jamesdaniels commentedon Apr 5, 2023
The current test checks the .next/server/pages-manifest.json and compares it the prerender manifest—any paths that we find that haven't been prerendered are marked a requiring a backend. The logic is here
firebase-tools/src/frameworks/next/index.ts
Line 140 in 0a4a4c2
Do you mind peeking at those manifest files and letting me know if you see anything obviously off with the heuristic?
jamesdaniels commentedon Apr 14, 2023
Agree, if the extension is .html we should be good.
Handle NextJS 13.3 app directory (#5691)
Handle NextJS 13.3 app directory (firebase#5691)
Handle NextJS 13.3 app directory (#5691)