-
Notifications
You must be signed in to change notification settings - Fork 37
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
Nextjs builds fail with Sentry and headlessui #611
Comments
Hi @brandinchiu, have you tried any of the solutions of not using a fragment? |
It's an external UI kit, so I have limited control in this case. Regardless, fragments are a fairly common react construct. Causing all builds to fail if one exists anywhere in the component tree is a bit extreme, imo. |
@brandinchiu This should fix your error 👍 |
Respectfully, I disagree with the premise that this is a headlessui issue. I don't even think it's a Sentry issue. But the Venn diagram here creates a legitimate problem, and I just can't see the solution being "never use a naked fragment as long as Sentry is installed". Or, this needs to be clearly documented as a drawback that anyone who uses react can't use fragments without an I am not working directly with headlessui. I am working with another UI kit that builds on top of headlessui. Your suggestion above suggests that using a fragment without an As I mentioned in my first reply, this feels exceptionally harsh. |
Well the thrown error from your reproduction repo is coming from headless ui and that is what I pointed out in my previous comment. |
Fair enough. My solution for now will be to simply disable I'll spend some time with it at a later date to see if there's a way for me to backfill any missing "as" props to sort this out. |
I've had exactly the same problem as @brandinchiu – using Catalyst, which is based on HeadlessUI, causes Sentry to error. It might not be the fault of Headless or Catalyst, but it would be useful to have something in the documentation to say that fragments can cause problems with reactComponentAnnotation. I wasted most of the day yesterday trying to figure out the problem until I realised there wasn't much I could do as it was caused by a dependency two layers deep. I'd even started looking for alternatives to Sentry before stumbling on a Discord comment that led me to this issue. |
@MattKevan sorry to hear that you spend so much time debugging this, we'll add a note on our docs! |
Environment
What version are you running? Etc.
"@headlessui/react": "^2.1.5",
"@heroicons/react": "^2.1.5",
"@sentry/nextjs": "^8.28.0",
"next": "14.2.8",
"react": "^18",
"react-dom": "^18"
I've created a point-in-time backup of my current working project here: https://github.com/brandinchiu/sentry-build-error
Disabling
reactComponentAnnotation
will allow the build to complete successfully.Steps to Reproduce
reactComponentAnnotation
enabled.Expected Result
Build should complete.
Actual Result
Build fails. Error is throw indicating that Nextjs prerendering failed when trying to inject Sentry annotations into components:
The text was updated successfully, but these errors were encountered: