Description
openedon Oct 28, 2024
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/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/node
SDK Version
8.35.0
Framework Version
Vue 8.35.0
Link to Sentry event
No response
Reproduction Example/SDK Setup
I have a Vue 3 (3.5.4) application using vue-router (4.4.3) and with SSR environment. In the Vue app I use @sentry/vue (8.35.0) and for production I use express node server.
Vue package.json
{
"scripts": {
...
"server:run": "NODE_ENV=production node --import ./server/instrument.js server"
}
}
server/instrument.js
import * as Sentry from '@sentry/node'
Sentry.init({
dsn: process.env.DSN,
tracesSampleRate: 1.0,
profilesSampleRate: 1.0,
})
server/index.js
import * as Sentry from '@sentry/node'
...
const { default: renderPage } = await import(path.join(root, 'dist/server/main.js')) /* Vue server client app. */
...
app.use('*', async (request, response) => {
try {
...
const { html, status, statusText, headers } = await renderPage(url, {
manifest,
preload: true,
request,
response,
})
...
})
...
Sentry.setupExpressErrorHandler(app)
...
app.listen(port)
After run the server with yarn server:run
I get the following error on first server call. The node server crashes completely.
TypeError: Cannot read properties of undefined (reading '__vccOpts')
at file:///.../node_modules/vue-router/dist/vue-router.mjs:2172:55
TypeError: Cannot read properties of undefined (reading '__vccOpts')
at file:///.../node_modules/vue-router/dist/vue-router.mjs:2172:55
file:///.../node_modules/vue-router/dist/vue-router.mjs:2172
const options = resolvedComponent.__vccOpts || resolvedComponent;
router/index.js
import { RouterView } from 'vue-router'
import { asyncLoadRouter } from '@common/helpers'
export default [
{
path: '/',
component: RouterView,
children: [
{
path: '',
component: asyncLoadRouter('WrapperHome'),
children: [
{
path: '',
name: 'home',
component: asyncLoadRouter('wrapper/Home'),
},
],
}
],
},
]
Steps to Reproduce
- Build Vue app with vite
- Run
yarn server:run
- Open application in browser
- Error is thrown.
Removing--import ./server/instrument.js
fromserver:run
script, the error is not thrown.
Expected Result
The server should run without throwing this error, like before adding @sentry/node
code. If I use only @sentry/vue
in the Vue app, all works fine. Adding @sentry/node
to express server script causes node server crash.
Is there also a way to isolate @sentry/node
import on express server from @sentry/vue
in Vue app?
Actual Result
After run the server with yarn server:run
I get the following error on first server call. The node server crashes completely.
node server log
TypeError: Cannot read properties of undefined (reading '__vccOpts')
at file:///.../node_modules/vue-router/dist/vue-router.mjs:2172:55
TypeError: Cannot read properties of undefined (reading '__vccOpts')
at file:///.../node_modules/vue-router/dist/vue-router.mjs:2172:55
file:///.../node_modules/vue-router/dist/vue-router.mjs:2172
const options = resolvedComponent.__vccOpts || resolvedComponent;
Metadata
Assignees
Type
Projects
Status
Waiting for: Community
Activity