Title: SvelteKit auto-instrumentation causes faulty JSX error · Issue #9318 · getsentry/sentry-javascript · GitHub
Open Graph Title: SvelteKit auto-instrumentation causes faulty JSX error · Issue #9318 · getsentry/sentry-javascript
X Title: SvelteKit auto-instrumentation causes faulty JSX error · Issue #9318 · getsentry/sentry-javascript
Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using the latest SDK release https://github.com/...
Open Graph Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th...
X Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/9318
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"SvelteKit auto-instrumentation causes faulty JSX error","articleBody":"### Is there an existing issue for this?\r\n\r\n- [X] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues\r\n- [X] I have reviewed the documentation https://docs.sentry.io/\r\n- [X] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases\r\n\r\n### How do you use Sentry?\r\n\r\nSentry Saas (sentry.io) as well as self-hosted (same issue occurs in both environments).\r\n\r\n### Which SDK are you using?\r\n\r\n@sentry/sveltekit\r\n\r\n### SDK Version\r\n\r\n7.74.1\r\n\r\n### Framework Version\r\n\r\n1.26.0\r\n\r\n### Link to Sentry event\r\n\r\nhttps://zenthropic.sentry.io/issues/4559398012/?project=4504934292258816\r\n\r\n### SDK Setup\r\n\r\n```ts\r\nSentry.init({\r\n dsn: 'https://3365729f7ba44228b319f4ad7ae32e6a@o4504934289506304.ingest.sentry.io/4504934292258816',\r\n tracesSampleRate: 1.0,\r\n});\r\n```\r\n\r\n### Steps to Reproduce\r\n\r\nI created a new minimum SvelteKit repro with Sentry to demonstrate this bug.\r\n\r\n1. Create new SvelteKit project\r\n ```bash\r\n npm create svelte@latest sentry-repro\r\n # - Skeleton project\r\n # - Yes, using TypeScript syntax\r\n # - skip other add-ons\r\n\r\n cd sentry-repro\r\n npm i\r\n ```\r\n2. Add Sentry using setup wizard\r\n ```bash\r\n npx @sentry/wizard@latest -i sveltekit\r\n # - Sentry SaaS\r\n # - yes\r\n # - select project\r\n ```\r\n3. Add a **`src/routes/+page.ts`** file with a TypeScript `\u003c>` cast operator\r\n ```ts\r\n export async function load() {\r\n let x: unknown = 'foo';\r\n console.log(\u003cstring>x);\r\n }\r\n ```\r\n4. Start dev server and open the page\r\n ```bash\r\n npm run dev\r\n # http://localhost:5173/\r\n ```\r\n5. Note the error:\r\n ```\r\n Internal server error: Unterminated JSX contents. (3:22)\r\n ```\r\n6. Modify `vite.config.ts` to disable auto-instrumentation:\r\n ```ts\r\n // add sentrySvelteKit config option\r\n autoInstrument: false\r\n ``` \r\n7. Note that the error goes away / page serves as expected\r\n\r\n### Expected Result\r\n\r\nNo error should occur at step 5.\r\n\r\nAuto-instrumentation should not (incorrectly) interpret TypeScript cast operator `\u003c>` as JSX.\r\n\r\nCurrent work-around: using `as` cast operator instead of `\u003c>`.\r\n\r\n\r\n### Actual Result\r\n\r\nThe following error occurs at step 5.\r\n\r\n```\r\nUnterminated JSX contents. (3:22)\r\nSyntaxError: Unterminated JSX contents. (3:22)\r\n at constructor (/Users/ken/Code/sentry-repro/node_modules/@babel/parser/lib/index.js:356:19)\r\n at V8IntrinsicMixin.raise (/Users/ken/Code/sentry-repro/node_modules/@babel/parser/lib/index.js:3223:19)\r\n at V8IntrinsicMixin.jsxReadToken (/Users/ken/Code/sentry-repro/node_modules/@babel/parser/lib/index.js:6605:20)\r\n at V8IntrinsicMixin.getTokenFromCode (/Users/ken/Code/sentry-repro/node_modules/@babel/parser/lib/index.js:6947:12)\r\n at V8IntrinsicMixin.getTokenFromCode (/Users/ken/Code/sentry-repro/node_modules/@babel/parser/lib/index.js:9852:11)\r\n at V8IntrinsicMixin.nextToken (/Users/ken/Code/sentry-repro/node_modules/@babel/parser/lib/index.js:2347:10)\r\n at V8IntrinsicMixin.next (/Users/ken/Code/sentry-repro/node_modules/@babel/parser/lib/index.js:2258:10)\r\n at V8IntrinsicMixin.eat (/Users/ken/Code/sentry-repro/node_modules/@babel/parser/lib/index.js:2262:12)\r\n at V8IntrinsicMixin.expect (/Users/ken/Code/sentry-repro/node_modules/@babel/parser/lib/index.js:3590:10)\r\n at V8IntrinsicMixin.jsxParseOpeningElementAfterName (/Users/ken/Code/sentry-repro/node_modules/@babel/parser/lib/index.js:6836:10\r\n```","author":{"url":"https://github.com/kenkunz","@type":"Person","name":"kenkunz"},"datePublished":"2023-10-19T20:07:55Z","url":"https://github.com/getsentry/sentry-javascript/issues/9318"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:9df2c203-e168-343e-9e9f-dd96315d98d4 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9B24:1B5E62:C8C9:108CC:6B042FCD |
| html-safe-nonce | 876b7d8e8322d17e4fe594794002f92f992e9422a7f6a09a44d6bb66a81cdd63 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QjI0OjFCNUU2MjpDOEM5OjEwOENDOjZCMDQyRkNEIiwidmlzaXRvcl9pZCI6IjY5NjMzNjE4MzY2MzI5MTE4MjEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 148e7642db18c3324436c429affcc92bafbcdfe4eb747b4cb000bda6cdd6c911 |
| hovercard-subject-tag | issue:1952977341 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/9318/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9c691202279826121501e9d7058a4bb0015f7fccc16fadb86498fbedf954f73d/getsentry/sentry-javascript/issues/9318 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9c691202279826121501e9d7058a4bb0015f7fccc16fadb86498fbedf954f73d/getsentry/sentry-javascript/issues/9318 |
| og:image:alt | Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | kenkunz |
| hostname | github.com |
| expected-hostname | github.com |
| None | b7a1d2b9101496921b08579fbee988d014345aef2f5bd660d1f8c7332d81560e |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3328572 |
| octolytics-dimension-repository_nwo | getsentry/sentry-javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3328572 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-javascript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | c3dd496c3da6ea6b77e69c09279d2b81604654f1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width