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.

deploying to Vercel causes conditional statements to evaluate incorrectly

See original GitHub issue

Bug report

Describe the bug

When rendering a page using Incremental Static Regeneration a *conditional statement is erroneously applied to the wrong element.

*I’m referring to conditional rendering expressions of the following form:

<div>
   {true && <div />}
   <div />
</div>

To Reproduce

  1. go to my repo, https://github.com/AHBruns/vercel-repro
  2. clone it, npm install, and *npm run dev
  3. inspect element
  4. you’ll see the following, which is correct:
<div>
   <div class="SHOW"></div>
</div>
  1. deploy the repo to Vercel
  2. go to the deployed site
  3. inspect element
  4. you’ll see the following, which is incorrect:
<div>
   <div class="NO_SHOW"></div>
</div>

*npm run build && npm run start yields the same problem

Expected behavior

A single div with the class SHOW should be added to the DOM regardless of the environment.

System information

  • Version of Next.js: v9.5.2
  • Version of Node.js: v14.3.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
timneutkenscommented, Aug 25, 2020

Did some investigating:

  • Added a next.config.js with target: 'experimental-serverless-trace'
  • Ran next build
  • The console.log in _app logged out /404 which is unexpected

So this is definitely a bug in Next.js, we’ll fix it 🙏

2reactions
ijjkcommented, Sep 14, 2020

Hi, this should be fixed in v9.5.4-canary.16 of Next.js please upgrade and give it a try!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I resolve a 'module not found' error? - Vercel
The 'module not found' error is a syntax error that appears when the static import statement cannot find the file at the declared...
Read more >
I am getting errors when deploying to Vercel. Can anyone ...
Firstly I'd recommend that you try run: yarn build or npm run build locally, as you'll be able to catch a lot of...
Read more >
Using GitHub actions and Vercel for end-to-end tests
If we now open up a PR, we'll see a new status that reports on the status of our E2E tests. Pointing the...
Read more >
Use Next.js and Vercel to build a link-sharing app using ...
js framework, which makes it easy to develop and deploy highly-optimized full-stack applications based on React. One of the most useful features Vercel...
Read more >
Hi all! Does anyone have problem... - Sanity.io community
Does anyone have problem on deoplloying on Vercel (Using Next. js as ... I have two test projects, and once deployed, they don't...
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