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

NotFoundError: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node. #1797

Closed
sentry-io bot opened this issue Jul 3, 2023 · 5 comments
Assignees
Labels
0 bug Something isn't working research

Comments

@sentry-io
Copy link

sentry-io bot commented Jul 3, 2023

Sentry Issue: REACT-COMMERCE-2EV

NotFoundError: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.
  at uH (app:///_next/static/chunks/framework-425b981863328f28.js:9:84991)
  at uB (app:///_next/static/chunks/framework-425b981863328f28.js:9:84675)
  at uH (app:///_next/static/chunks/framework-425b981863328f28.js:9:85442)
  at uQ (app:///_next/static/chunks/framework-425b981863328f28.js:9:86232)
  at uq (app:///_next/static/chunks/framework-425b981863328f28.js:9:86692)
...
(45 additional frame(s) were not displayed)
@sterlinghirsh sterlinghirsh added 0 bug Something isn't working research labels Jul 7, 2023
@danielcliu-ifixit
Copy link
Member

danielcliu-ifixit commented Jul 18, 2023

function uH(e, n, t) {
  if (e6 && "function" == typeof e6.onCommitFiberUnmount)
      try {
          e6.onCommitFiberUnmount(e5, t)
      } catch (e) {}
  switch (t.tag) {
  case 5:
      uT || uM(t, n);
  case 6:
      var r = uA
        , l = uj;
      uA = null,
      uB(e, n, t),
      uA = r,
      uj = l,
      null !== uA && (uj ? (e = uA,
      t = t.stateNode,
      8 === e.nodeType ? e.parentNode.removeChild(t) : e.removeChild(t)) : uA.removeChild(t.stateNode)); // last removeChild is where the error is happening
      break;
  case 18:
      null !== uA && (uj ? (e = uA,
      t = t.stateNode,
      8 === e.nodeType ? r_(e.parentNode, t) : 1 === e.nodeType && r_(e, t),
      nM(e)) : r_(uA, t.stateNode));
      break;
  case 4:
      r = uA,
      l = uj,
      uA = t.stateNode.containerInfo,
      uj = !0,
      uB(e, n, t),
      uA = r,
      uj = l;
      break;
  case 0:
  case 11:
  case 14:
  case 15:
      if (!uT && null !== (r = t.updateQueue) && null !== (r = r.lastEffect)) {
          l = r = r.next;
          do {
              var a = l
                , u = a.destroy;
              a = a.tag,
              void 0 !== u && (0 != (2 & a) ? uF(t, n, u) : 0 != (4 & a) && uF(t, n, u)),
              l = l.next
          } while (l !== r)
      }
      uB(e, n, t);
      break;
  case 1:
      if (!uT && (uM(t, n),
      "function" == typeof (r = t.stateNode).componentWillUnmount))
          try {
              r.props = t.memoizedProps,
              r.state = t.memoizedState,
              r.componentWillUnmount()
          } catch (e) {
              o$(t, n, e)
          }
      uB(e, n, t);
      break;
  case 21:
  default:
      uB(e, n, t);
      break;
  case 22:
      1 & t.mode ? (uT = (r = uT) || null !== t.memoizedState,
      uB(e, n, t),
      uT = r) : uB(e, n, t)
  }
}

@danielcliu-ifixit
Copy link
Member

also timing of these showing up seems to coincide with #1726

@danielcliu-ifixit
Copy link
Member

it seems like this has been solved via the swcMinify pull #1846

@federicobadini
Copy link
Contributor

Great, let's keep an eye on this though.
Nextjs is pushing swc so I think on the long term we will have to check back because they will invest in that direction.
Let's keep this open for a while and let's check back in some months

@federicobadini
Copy link
Contributor

Even after a while this is still not showing out anymore.
Nextjs repo still has some swcMinify related open issue though, so let's keep it off until there will be an official deprecation.

jarstelfox added a commit that referenced this issue Nov 27, 2023
This small change took some digging.

1) We decided to try setting this to false in hopes of fixing two issues

#1797
#1846

The first issue was fixed (1797) while the second issue was not (1846).

2) Next 14 fails to build with terser enabled.

This is because terser doesn't support node some out the new tsx used by Next 14.
The error is:

../pages/_document.js from Terser
Unexpected token: punc ({) [../pages/_document.js:675,10]

My best guess from some googling is this is due to the class static keyword:
terser/terser#1160

However, this is fixed simply by using the SWC minifier (default) instead of terser.

3) Now with Next 14 the docs claim we shouldn't need terser anymore: https://nextjs.org/docs/architecture/nextjs-compiler
In fact, Terser will not be supported in Next 15 slated for release next year.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0 bug Something isn't working research
Projects
None yet
Development

No branches or pull requests

3 participants