v3.2.0 Breaks Preview Mode?
See original GitHub issueIssue Summary
I upgraded from @sls-next/serverless-component@1.19.1-alpha.5
to @sls-next/serverless-component@v3.2.0
(as in my serverless.yml). Deployed with no other changes, and now preview mode isn’t working.
- @dphang I chose
v3.2.0
to get the no-op rewrites support, also because it was a release version.
Actual behavior
Preview mode doesn’t work
Expected behavior
Preview mode works
Steps to reproduce
Use v3.2.0
Screenshots/Code/Configuration/Logs
Versions
- OS/Environment: Mac OS
- @sls-next/serverless-component version:
v3.2.0
- Next.js version:
10.2.4-canary.2
(was on this version before upgradingserverless-next.js
and everything worked fine.)
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
setPreviewData not triggering runtime call of getStaticProps as ...
Deploy application using @sls-next/cdk-construct@3.2.0-alpha.12 . Enable preview mode and go to route which has getStaticProps and preview ...
Read more >Visual Studio 2022 Preview Release Notes | Microsoft Learn
Get the latest pre-release features, bug fixes, and support for Visual Studio 2022 Preview. Download today.
Read more >Preview Survey - Qualtrics
In the preview survey mode, you can answer questions and move through the survey the same way your respondents would with a real...
Read more >Just-in-Time Mode - Tailwind CSS
We see the JIT engine as a preview of what we plan to ship as Tailwind CSS v3.0, so there are a few...
Read more >Upgrading from v2 to v3 — MathJax 3.2 documentation
For example, MathJax v2 updates the page in phases, first removing the math source expressions (e.g., the TeX code), then inserts a preview...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@patricktyndall Correct the base page
/
evaluates to use the non dynamic SSR routes. As this SSG condition already had the!isPreview
condition it bypass and pass to the SSR render just below it. https://github.com/serverless-nextjs/serverless-next.js/blob/800de8740980e103b4fc71b5fe6c8c5fdc2f8274/packages/libs/core/src/route/page.ts#L43However the rest of the paths for
[[...slug]]
would evaluate to a dynamic route. With no check for preview bypass so it would serve the SSG version rather than the SSR version. https://github.com/serverless-nextjs/serverless-next.js/blob/800de8740980e103b4fc71b5fe6c8c5fdc2f8274/packages/libs/core/src/route/page.ts#L96After a little debugging I found the cause. See PR with fix.
When route was dynamic e.g.
[[...slug]]
data and page routes would return the SSG content, rather than the SSR.Added the same
&& !isPreview
to ensure it matches the same logic used on non dynamic routes.