Comments (9)
@DiederikvandenB It's a simple nuxt plugin :
// plugins/axios.js
export default function({ $axios, store, error, app }) {
$axios.onError(e => {
if (process.client) {
app.$sentry.configureScope(scope => {
scope.setExtra("request", e);
app.$sentry && app.$sentry.captureException(e.response.data);
});
}
return Promise.reject(e);
});
}
// nuxt.config.js
module.exports = {
modules: [
"@nuxtjs/axios",
],
plugins: [
"@/plugins/axios",
],
}
from sentry-module.
@seandelaney solution for me was (as you can see in the thread)
using
app.$sentry
with module updated to v2.
from sentry-module.
Ok I think I finally get it ! My guess :
Sentry is working in client side only, but the plugin is not registered for client side only cause I need it to be initiated in server side (as I need for axios)
But I am calling $sentry
only in $axios.onError(e => { ... app.$sentry })
through app
and its working cause by the time $sentry
had time to be injected !
from sentry-module.
This issue as been imported as question since it does not respect sentry-module issue template. Only bug reports and feature requests stays open to reduce maintainers workload.
If your issue is not a question, please mention the repo admin or moderator to change its type and it will be re-opened automatically.
Your question is available at https://cmty.app/nuxt/sentry-module/issues/c34.
from sentry-module.
- there no $raven in latest version of nuxt sentry, its $sentry
- export default function({ $axios, store, error, {app: { $sentry } }) {
from sentry-module.
@aldarund Thanks !
I was using v1 of sentry module using $raven.
So I have updated module to v2.
Some details
I don't know why, It doesn't work with destructured assignement :
export default function({ $axios, store, error, app: { $sentry } }) {
=> $sentry
is still undefined.
It works though with :
export default function({ $axios, store, error, app }) {
and then accessing $sentry
: app.$sentry
from sentry-module.
Could you maybe share some more code? In which file are you calling this code, what are you importing, etc.
from sentry-module.
What was the solution?
I have a similar issue where $sentry
is undefined within my plugin: https://cmty.app/nuxt/sentry-module/issues/c36
from sentry-module.
Sorry for not responding! Completely forgot. Very glad you were able to resolve it yourself.
from sentry-module.
Related Issues (20)
- Version 2.7.5 breaks in nuxt 2.16.3 HOT 3
- Support @sentry/webpack-plugin v2
- Latest version HOT 1
- Should build fail if `publishRelease` fail because Sentry instance is down ? HOT 5
- IgnoreMissing doesnt work HOT 2
- Unsure how this module is suppose to work HOT 5
- Unable to load the plugin, this.nuxt is undefined HOT 1
- Sentry Performance tracing does not work when lazy is set to true HOT 3
- FATAL WebpackPlugin is not a constructor error HOT 2
- Unable to view Sentry Replays in Production HOT 4
- TypeError: undefined is not an object (evaluating 'pt.push') HOT 2
- build is failing: Cannot read properties of undefined (reading 'nuxt') HOT 2
- Make transaction name configurable for performance monitoring. HOT 1
- Nuxt 3 Support HOT 28
- TypeScript Compilation Error in module.d.ts HOT 2
- Issues Implementing Session Replay with @nuxtjs/sentry: Transport Disabled Error HOT 3
- Manually start replay HOT 6
- Sentry is always disabled. What am I doing wrong? HOT 1
- Cannot use "Replay" client integration HOT 9
- After upgrade experiencing syntax error with importing merge from lodash HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sentry-module.