Broken custom dataloader methods
Is there an existing issue for this?
- [x] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- [x] I have reviewed the documentation https://docs.sentry.io/
- [x] 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.33.1
Framework Version
fastify 5.0.0
Link to Sentry event
No response
Reproduction Example/SDK Setup
No response
Steps to Reproduce
The automated dataloader integration added in https://github.com/getsentry/sentry-javascript/pull/13664 breaks my code.
I have a dataloader like this:
export class ProductDataloader extends DataLoader {
constructor() {
super(async (globalIds: ReadonlyArray<string>) => {
return batchFn(globalIds);
});
}
public async loadByInternalId(id: number) {
const globalId = toGlobalId('Product', id);
return this.load(globalId);
}
}
Expected Result
That code worked OK until "@sentry/node": "8.30.0"
Actual Result
After upgrade to "@sentry/node": "8.31.0" or later, calling loadByInternalId method fails:
context.dataloaders.product.loadByInternalId is not a function
Hey @michalsanger sorry for the trouble here! For now you can disable the dataloader integration like so:
Sentry.init({
// ...
integrations: function (integrations) {
// filter out Dataloader integration due to bug
return integrations.filter(function (integration) {
return integration.name !== "Dataloader";
});
},
});
docs: https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/#removing-a-default-integration
@onurtemizkan could you help investigate why this is happening?
@AbhiPrasad thanks for the workaround, works OK.
Opened a PR upstream to fix this: https://github.com/open-telemetry/opentelemetry-js-contrib/pull/2498
@onurtemizkan I guess this has since been released and should be fixed, since v10 where we are on latest of the instrumentation again?
@mydea - Yes, this should be resolved