question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

v3.2.0 Breaks Preview Mode?

See original GitHub issue

Issue 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 upgrading serverless-next.js and everything worked fine.)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
J3ttocommented, Aug 25, 2021

Thanks @J3tto! Just to confirm – does that explain why it would have been working for the “base” page of the dynamic route?

@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#L43

However 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#L96

1reaction
J3ttocommented, Aug 25, 2021

After 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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found