Skip to content

Compatibility issue with Sentry + Next.js #14

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

Open
rnbrady opened this issue Jan 7, 2025 · 3 comments · May be fixed by #15
Open

Compatibility issue with Sentry + Next.js #14

rnbrady opened this issue Jan 7, 2025 · 3 comments · May be fixed by #15

Comments

@rnbrady
Copy link

rnbrady commented Jan 7, 2025

When using with Next.js 15, if Sentry is added to the project then rendering fails with Uncaught TypeError: Failed to construct 'HTMLElement': Please use the 'new' operator, this DOM object constructor cannot be called as a function.

The error can be resolved by upgrading Stencil. PR to follow shortly.

See rnbrady/qrcode-sentry-issue for reproduction. Before vs after adding Sentry:

Screenshot 2025-01-07 at 14 06 39

The issue seems to be specific to Next.js or React as I'm unable to reproduce it by adding Sentry to the vanilla HTML + Js demo pages.

@rnbrady rnbrady linked a pull request Jan 8, 2025 that will close this issue
@frederichoule
Copy link

Hey @rnbrady

Since the PR hasn’t been merged in over 3 months, would you consider publishing your fork to npm?

Right now the GitHub repo is missing the dist/ folder, so it can’t be used directly as a dependency.

@rnbrady
Copy link
Author

rnbrady commented Apr 23, 2025

@frederichoule the best solution is to vendor the package with the changes you want. You build the package (npm run build) and compress it (npm pack) into a tarball which you copy into your project (e.g. in a top level vendor folder) and commit to git.

Then you npm install or pnpm add that tarball, after which you package.json will look like this:

"dependencies": {
    "@bitjson/qr-code": "file:vendor/bitjson-qr-code.tar.gz",
}

Your package manager extracts the tarball into node_modules.

@frederichoule
Copy link

@frederichoule the best solution is to vendor the package with the changes you want. You build the package (npm run build) and compress it (npm pack) into a tarball which you copy into your project (e.g. in a top level vendor folder) and commit to git.

Then you npm install or pnpm add that tarball, after which you package.json will look like this:

"dependencies": {
    "@bitjson/qr-code": "file:vendor/bitjson-qr-code.tar.gz",
}

Your package manager extracts the tarball into node_modules.

Thanks! I will try that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants