Replies: 90 comments 43 replies
-
Perhaps there are dates when this is scheduled to be done? Or is it better to use Pages Router? FYI: Gatsby allows you to use dynamic routers in static exports without configuring server-side redirects. That's the only thing stopping us from moving our PWAs from Gatsby to Next.js |
Beta Was this translation helpful? Give feedback.
-
I did not see this error on 13.4.13. I started seeing it when I upgraded to 13.5.3. |
Beta Was this translation helpful? Give feedback.
-
Can confirm this is working on 13.4.13. I'm curious if the functionality is therefore a regression or a bug that's become a feature 😅 |
Beta Was this translation helpful? Give feedback.
-
But does it output the static page? If it doesn't and there is no error, then it's definitely a regression. |
Beta Was this translation helpful? Give feedback.
-
@petejodo What does "working" mean in this case? Previously there was no error message but it was failing silently. So in 13.5.0, a helpful error message was added explaining how to fix it. See #48022 (comment) for more details. However maybe there is a case when the error message shouldn't be printed? If you have code that was working with Please do NOT comment on this issue since it describes a new feature that needs to be implemented (not a regression). |
Beta Was this translation helpful? Give feedback.
-
I can confirm that this issue persisted in version 13.4.13 as well. It failed silently as you said; there was no error during the build, but accessing the dynamic route resulted in a 404 error. |
Beta Was this translation helpful? Give feedback.
-
yeah I didn't see that at first and thought that it was working in my testing but I guess I somehow messed something up in my testing where I thought it was working but it definitely was not. Sorry, my mistake! This put me in a bind because I misinterpreted the opening paragraphs to https://nextjs.org/docs/app/building-your-application/deploying/static-exports which made it seem I could port a SPA to nextjs and we just about finished porting it. That's my problem though, not yours' 😅 I think I can re-hack react-router back in even though that was giving me trouble at the start of the project |
Beta Was this translation helpful? Give feedback.
This comment was marked as off-topic.
This comment was marked as off-topic.
-
Hi, is this related to the error encountered in @leerob SPA example? The error message seems surprising, and params are meant to be obtained via page props rather than the |
Beta Was this translation helpful? Give feedback.
-
Hi, I just started learning Next.js and I want to deploy my app as static SPA on Amazon S3. Hence, I added
I'm stuck here. What am I supposed to do to get the dynamic routes working with the static export? Maybe, I'm don't fully understand |
Beta Was this translation helpful? Give feedback.
-
@goerlitz starting step 3 and 4 I think you get confused:
The thing is that if you use a dummy static param, Next only knows the dummy "/datasets/foo" route. So "/datasets/bar" won't work. You could do an URL rewrite from "/datasets/bar" to "/datasets/foo", but then the route parameter is lost. You could opt for a query parameter instead. Sadly until Next.js supports exporting dynamic routes that are not statically rendered like it did in Next 12 |
Beta Was this translation helpful? Give feedback.
-
Thanks @eric-burel for the guidance. Having worked on SPA with Api backends in the past, I thought I could make Next.js output a SPA bundle with separate api code. Actually, I think that the first paragraph in https://nextjs.org/docs/app/building-your-application/deploying/static-exports is quite misleading in that sense:
No, Next.js is not made for SPAs - it is a totally different paradigm with the goal to NOT do all rendering and routing in the browser but move more code to the server where computing is more efficient (SSR etc.). Hence, a typical Next.js app will never be an SPA (and should not be), because the application code is split up and runs on server and client likewise. IMHO, for most applications - that usually have dynamic routing - the static export does not make sense to me at all. |
Beta Was this translation helpful? Give feedback.
-
Does exists on 13.5.5 as well, I have tried to build a view with this routing structure:
on production i had issues for previous versions, [id] was not found and it was navigating to home page, and now not even able to build to the this issue:
|
Beta Was this translation helpful? Give feedback.
-
Can you please give an update, when this feature is planned? I mainly switchedto nextjs, because of the routing functionality. Now it forces me to host on a node server... As a workaround i try out useing pages router again. [https://nextjs.org/docs/pages/building-your-application/routing/pages-and-layouts] |
Beta Was this translation helpful? Give feedback.
-
@andreasfrey, this is what I meant with "Next.js follows a different paradigm" than SPA. If you are trying to use Next.js to create a traditional SPA (with dynamic routes) that can be packaged for hosting on a CDN, then you are doing something (conceptually) wrong. This is not what Next.js was designed for. If you want to move from an SPA to Next.js (with all the nice features, like SSR etc.), you should
|
Beta Was this translation helpful? Give feedback.
-
Friends, it will come, not sure when though. |
Beta Was this translation helpful? Give feedback.
-
Hi all, just wanted to let you know that the issue was moved to discussion, but it not because of de-prioritizing! We have just done some cleanup on the repo, as per our triaging documentation, which states that feature requests are not supposed to be opened as issues. We welcome further discussions on this topic, and will keep tracking it. |
Beta Was this translation helpful? Give feedback.
-
Just ran into a problem with this :/ Please fix this Vercel |
Beta Was this translation helpful? Give feedback.
-
I am migrating my code from CRA (create react app) to next.js and I can't use dynamic routes anymore because of this issue. Please fix it or at least put a workaround/explanation in the migration guide. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the clarifications about the pages router @leerob ! :) I just want to know whether the dev team is planning to add / fix that functionality in the app router or not. If not then I would just migrate back to the pages router. If there's a fix incoming during the next half year however I would just wait. Getting a clarification on the future of this topic would be great! |
Beta Was this translation helpful? Give feedback.
-
Reverting to using paging router worked for me. I feel like there should be an option to run routing in App Router client side though. |
Beta Was this translation helpful? Give feedback.
-
Has there been any progress on this issue yet? I’m currently facing the same problem and wondering if there's a workaround or an update available. |
Beta Was this translation helpful? Give feedback.
-
The ongoing issue with statically exporting dynamic routes using the App Router in Next.js is a major issue that you have failed to fix for 10 months. Despite promises to address this critical problem, it has now been closed and downgraded to a discussion without any notice, explanation, or resolution. This is completely unacceptable. Many of us rely on Next.js for its static site generation capabilities, including dynamic routes, and this has severely impacted our projects. The lack of resolution and communication on such a foundational issue is beyond frustrating. Let me remind you, @leerob, of your comment on the original issue:
The Next.js team needs to understand that there is no point in jumping on the AI hype train et al if the foundational aspects of your framework aren't even there. We expect transparency, accountability and given that @vercel is a $3.25 bln dollar compay, a rapid resolution to this regression. It’s time for the team to take responsibility and address this promptly. Thank you. |
Beta Was this translation helpful? Give feedback.
-
Lack of support for client side dynamic routes limits hosting optionality for sites using app router, which is why many are frustrated by this issue. It doesn't seem like its in Vercel's best interest to offer great support for SSG with Next.js, because then devs can just host on S3 or whatever CDN, instead of being locked into Vercel or other serverless / edge providers. Hoping maintainers jump on this and prove me wrong, but does highlight the conflict of interest that often arises with an open core business model. In the meantime, our options are:
|
Beta Was this translation helpful? Give feedback.
-
Could an explanation be provided regarding the differences between using |
Beta Was this translation helpful? Give feedback.
-
I did not want to move back to pages router, so I ended up building a workaround where we generate fallback static pages then redirect to the fallback for dynamic routes via a cloudfront edge function. Ended up turning the solve into a small utility lib which you can check out here: |
Beta Was this translation helpful? Give feedback.
-
Hej, coming from #54393, I have the same issue after following the guide https://nextjs.org/docs/pages/building-your-application/upgrading/from-create-react-app#step-7-create-the-entrypoint-page to convert a CRA app into a Next one. I get many errors like |
Beta Was this translation helpful? Give feedback.
-
As people have said, with the release of v15 now with this still not being addressed, it's pretty clear this isn't going to be resolved. |
Beta Was this translation helpful? Give feedback.
-
The year is 2067. All world governments have fallen. Vercel-branded killer drones patrol the skies, searching for members of the static rendering resistance. At last, the final safehouse is located. As the rebels are dragged into the prison transport by shock troops, one cries out "It wasn't supposed to be like this! You promised we'd be able to do static rendering with the App Router!" The eyes on the commander's helmet light up as he replies: "Yes, we plan to support this for the App Router as well in the future. We don't have a defined timeline yet, so Pages Router might be a better choice for you right now." And he slams the door. |
Beta Was this translation helpful? Give feedback.
-
Workaround: This is what I did to workaround this in Readest project, an open-source cross-platform ebook reader. Readest has a Web version and a Tauri version(which requires an
I conditionally set the
And add two pages:
And at runtime route to the page for that platform accordingly with a The full change is in this commit: readest/readest@242fbf6 Updated (2024-12-25): And the App Router and the Pages Router can coexist in one project. I just moved the dynamic route page and the API route into the |
Beta Was this translation helpful? Give feedback.
-
Verify canary release
Provide environment information
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 22.5.0 Binaries: Node: 18.17.1 pnpm: 8.6.12 Relevant Packages: next: 13.4.20-canary.2 react: 18.2.0 react-dom: 18.2.0 Next.js Config: output: export
Which area(s) of Next.js are affected? (leave empty if unsure)
App Router, Static HTML Export (output: "export")
Link to the code that reproduces this issue or a replay of the bug
https://github.com/curated-tests/next-issue-48022
To Reproduce
The page in question is /app/blog-app/[slug]/page.tsx
Describe the Bug
Fails with an error:
This is expected right now because its not implemented, but it would be nice to support this so that App Router can match Pages Router.
Expected Behavior
Ideally, the build should complete and navigation should work client side.
/blog-app/
)/blog-app/one
)Which browser are you using? (if relevant)
Chrome
How are you deploying your application? (if relevant)
python3 -m http.server 3000
NEXT-1550
Beta Was this translation helpful? Give feedback.
All reactions