plugin.client serializeFunction make transport not work
Version
@nuxtjs/sentry: latest nuxt: latest
Sentry configuration
default using fetch. and somehow my project can not use fetch. so i replace it with xhr
module.exports = {
modules: ["@nuxtjs/sentry"],
sentry: {
dsn: "DSN", // Enter your project's DSN here
// Additional Module Options go here
// https://sentry.nuxtjs.org/sentry/options
config: {
// Add native Sentry config here
// https://docs.sentry.io/platforms/javascript/guides/vue/configuration/options/
transport: Sentry.Transports.XHRTransport
}
}
}
Reproduction Link
Steps to reproduce
wait for 2 seconds, console will log en error
What is Expected?
no error and sentry works
What is actually happening?

it seems that plugin.client.js#L24 which use serializeFunction from @nuxt/utils make the transport function give this error.
import { BaseBackend } from '@sentry/core';
var BrowserBackend = /** @class */ (function (_super) {
__extends(BrowserBackend, _super);
function BrowserBackend() {
return (_super !== null && _super.apply(this, arguments)) || this;
}
return BrowserBackend;
})(BaseBackend);
the BrowserBackend function is the function passing into serializeFunction(), turns into a function below:
transport: function transport() {
return _super !== null && _super.apply(this, arguments) || this;
}
here is the error: _super is not defined
The configuration needs to be serialized one way or another. This is how Nuxt modules work. So you can't just reference some import in your configuration like that and expect it to work...
....At least for client-side configuration. For server-side it should work.
And in this case, I guess you only want to override the transport on the server side. If so then try setting transport in serverConfig rather than config.
The configuration needs to be serialized one way or another. This is how Nuxt modules work. So you can't just reference some import in your configuration like that and expect it to work...
....At least for client-side configuration. For server-side it should work.
And in this case, I guess you only want to override the transport on the server side. If so then try setting
transportinserverConfigrather thanconfig.
thanks for anwser. after i tried setting transport in serverConfig or clientConfig. still got the same error.
So do you need to override it for server or the client?
But I see now why the server options will also not work in this case. This is because this module "freezes" the server options at build time. The reason this is done like that is explained in #205.
I suppose the original fix could be changed to only "freeze" the release version and let the other options but decided at runtime which would make this work for the server-side at least. But I'm not sure now whether you want to fix it on the client or server side.
But I see now why the server options will also not work in this case. This is because this module "freezes" the server options at build time. The reason this is done like that is explained in #205.
I suppose the original fix could be changed to only "freeze" the release version and let the other options but decided at runtime which would make this work for the server-side at least. But I'm not sure now whether you want to fix it on the client or server side.
the client side