Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.tsx layout breaks entire site in production, .jsx works fine #65380

Open
dymoo opened this issue May 5, 2024 · 5 comments
Open

.tsx layout breaks entire site in production, .jsx works fine #65380

dymoo opened this issue May 5, 2024 · 5 comments
Labels
bug Issue was opened via the bug report template. Runtime Related to Node.js or Edge Runtime with Next.js.

Comments

@dymoo
Copy link

dymoo commented May 5, 2024

Link to the code that reproduces this issue

https://github.com/dymoo/next-docker-layoutbroken-example

To Reproduce

  1. clone example git repo
  2. docker-compose up
  3. nav to localhost:3099
  4. page doesn't display
  5. check console, minified react errors

I fixed this error in my own project by changing the nested layout to a jsx file. I am unable to reproduce the fix in the example repo?

Current vs. Expected behavior

While deploying with docker the entire page breaks, outputs minified react errors

Uncaught Error: Minified React error #418;
Uncaught Error: Minified React error #423;
DOMException: Failed to execute 'appendChild' on 'Node': Only one element on document allowed
DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.
Uncaught AggregateError

Provide environment information

OS: Darwin MacBook-Air-3.local 23.4.0 Darwin Kernel Version 23.4.0: Fri Mar 15 00:12:41 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T8103 arm64

m1 air 16gb ram

Node docker images used 18-slim, 18-alpine, 20-slim, 20-alpine

Which area(s) are affected? (Select all that apply)

Runtime

Which stage(s) are affected? (Select all that apply)

Other (Deployed)

Additional context

Ive tried adding removing everything from my next config, .dockerignore, trying different base images, tried yarn, running a shell inside the container to see around, with / without a custom server, downgrading to 14.1, trying latest next version (currently on), different next config output settings, Nothing. -- I've wasted like 2 days on troubleshooting and I'm stumped!

@dymoo dymoo added the bug Issue was opened via the bug report template. label May 5, 2024
@github-actions github-actions bot added the Runtime Related to Node.js or Edge Runtime with Next.js. label May 5, 2024
@dymoo
Copy link
Author

dymoo commented May 5, 2024

I think it's something to do with my structure being ./app/app/... -- Even if the page displays there is some weird behaviour

I changed it to /app/dash/... and it's all ok now.

Doesnt seem anything to do with jsx/tsx, just jsx doesn't seem to throw the minified errors...

tldr; don't do /app/app/...

EDIT: this was impossible to track down, maybe get next to throw an error if there is ./app/app/... layout? I cannot be the only one that wanted my dashboard on my sites /app ???

@AbhiShake1
Copy link
Contributor

@ijjk what would you suggest we do? Throw an error or make app/pages route work?

@dymoo
Copy link
Author

dymoo commented May 6, 2024

@ijjk what would you suggest we do? Throw an error or make app/pages route work?

At minimum throw an error, this took two full days of troubleshooting to fix.

@icyJoseph
Copy link
Contributor

How did this even run? The root layout has no html, nor body tags, the submitted reproduction repository is bound to fail.

@sharadregoti
Copy link

@dymoo Thank you. I was facing this issue for the last 5 days. Renaming the /app/app to /app/dash worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue was opened via the bug report template. Runtime Related to Node.js or Edge Runtime with Next.js.
Projects
None yet
Development

No branches or pull requests

4 participants