Skip to content

fix(feedback): Wait for document to be ready before doing autoinject #12294

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

Merged
merged 2 commits into from
May 30, 2024

Conversation

ryan953
Copy link
Member

@ryan953 ryan953 commented May 30, 2024

The error that folks are getting is something like this: [Error] TypeError: null is not an object (evaluating 'qo.body.appendChild')

The problem seems to be that we're trying to inject the button into the html before the <body> is ready. Using async <script defer> or <script async> would probably help, but none of our snippets have that, and it would also defer error observers and everything else.

What we can do for users it have the feedback integration wait before inserting the button + styles!
This is a great reference: https://developer.mozilla.org/en-US/docs/Web/API/Document/DOMContentLoaded_event

Fixes #12112

@ryan953 ryan953 requested a review from a team as a code owner May 30, 2024 19:02
Copy link
Contributor

github-actions bot commented May 30, 2024

size-limit report 📦

Path Size
@sentry/browser 21.74 KB (0%)
@sentry/browser (incl. Tracing) 32.73 KB (0%)
@sentry/browser (incl. Tracing, Replay) 68.3 KB (0%)
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 61.62 KB (0%)
@sentry/browser (incl. Tracing, Replay with Canvas) 72.36 KB (0%)
@sentry/browser (incl. Tracing, Replay, Feedback) 84.47 KB (+0.04% 🔺)
@sentry/browser (incl. Tracing, Replay, Feedback, metrics) 86.32 KB (+0.04% 🔺)
@sentry/browser (incl. metrics) 25.91 KB (0%)
@sentry/browser (incl. Feedback) 37.9 KB (+0.1% 🔺)
@sentry/browser (incl. sendFeedback) 26.32 KB (0%)
@sentry/browser (incl. FeedbackAsync) 30.86 KB (+0.12% 🔺)
@sentry/react 24.51 KB (0%)
@sentry/react (incl. Tracing) 35.78 KB (0%)
@sentry/vue 25.72 KB (0%)
@sentry/vue (incl. Tracing) 34.57 KB (0%)
@sentry/svelte 21.87 KB (0%)
CDN Bundle 23.11 KB (0%)
CDN Bundle (incl. Tracing) 34.46 KB (0%)
CDN Bundle (incl. Tracing, Replay) 68.39 KB (0%)
CDN Bundle (incl. Tracing, Replay, Feedback) 73.56 KB (+0.04% 🔺)
CDN Bundle - uncompressed 68 KB (0%)
CDN Bundle (incl. Tracing) - uncompressed 102.1 KB (0%)
CDN Bundle (incl. Tracing, Replay) - uncompressed 212 KB (0%)
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 224.46 KB (+0.04% 🔺)
@sentry/nextjs (client) 35.12 KB (0%)
@sentry/sveltekit (client) 33.36 KB (0%)
@sentry/node 115.24 KB (0%)
@sentry/aws-serverless 103.73 KB (0%)

@ryan953 ryan953 enabled auto-merge (squash) May 30, 2024 20:50
@ryan953 ryan953 merged commit b4332c1 into develop May 30, 2024
103 checks passed
@ryan953 ryan953 deleted the ryan953/12112-feedback-wait-for-document-ready branch May 30, 2024 20:53
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 this pull request may close these issues.

Cannot read properties of null (reading 'appendChild') on init with FeedbackIntegration
3 participants