Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Broken @sentry/vue jest mock #6037

@Tofandel

Description

@Tofandel

Is there an existing issue for this?

How do you use Sentry?

Self-hosted/on-premise

Which package are you using?

@sentry/vue

SDK Version

7.16

Framework Version

No response

Link to Sentry event

No response

Steps to Reproduce

Simply use a dynamic import

import(/* webpackChunkName: "sentry" */'@sentry/vue').then(({init}) => {
    init({
      Vue,
      environment: process.env.SERVE ? 'local' : process.env.NODE_ENV,
      dsn: process.env.VUE_APP_SENTRY_DSN,
    })
});

Or

import(/* webpackChunkName: "sentry" */'@sentry/vue').then(({ setUser }) => {
  setUser({ id, email, username: (first_name + ' ' + last_name).trim() });
});

Expected Result

Sentry to initialize correctly

Actual Result

TypeError: init is not a function

This happened between 7.15 (last known working version) and 7.16

The @sentry/core dynamic import still seems to work, but the init one is specific to @sentry/vue and cannot be used with a dynamic import anymore

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions