-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
Meta: Help WantedPackage: nodeIssues related to the Sentry Node SDKIssues related to the Sentry Node SDK
Description
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 package are you using?
@sentry/node
SDK Version
7.31.1
Framework Version
Apollo Server 4.3.1 (on @apollo/server)
Link to Sentry event
No response
SDK Setup
Setting file
const sentry = ({ config, db }: FastifyInstance): SentryPluginOptions => {
// Get log level
const log = config.get('log');
const debug = getLogLevel(log) <= getLogLevel(LogLevel.DEBUG);
// Get Sentry settings
const { dsn, enabled, tracesSampleRate } = config.get('sentry');
// Configure integrations
const integrations = [
new Integrations.Apollo(),
new Integrations.Prisma({ client: db }),
];
return {
debug,
dsn,
enabled,
integrations,
tracesSampleRate,
};
};Plugin file
const pluggable: FastifyPluginAsync<SentryPluginOptions> = async (
instance,
opts,
) => {
init(opts);
const errorHandler = (error: FastifyError, request: FastifyRequest) => {
const clientIp = requestIp.getClientIp(request);
const user = {
ip_address: clientIp ?? undefined,
};
const scopeHandler = (scope: Scope) => {
scope.setUser(user);
scope.setTag('path', request.raw.url);
captureException(error);
};
withScope(scopeHandler);
};
instance.setErrorHandler(errorHandler);
};
export const SentryPlugin = plugin<SentryPluginOptions>(pluggable);Steps to Reproduce
- After defining the whole stack (Fastify, Apollo Server)
- Install the latest Sentry Node SDK
- Configure the sentry environment variables with the correct DSN
- Try to connect the aforementioned plugin
Expected Result
Connect seamlessly using @apollo/server instead of apollo-server-core.
Actual Result
It throws the error:
Apollo Integration was unable to require
apollo-server-corepackage
The reason is that the Apollo Server package is hardcoded into the SDK:
https://github.com/getsentry/sentry-javascript/blob/master/packages/tracing/src/integrations/node/apollo.ts#L42-L47
pepf and wodCZdvins
Metadata
Metadata
Assignees
Labels
Meta: Help WantedPackage: nodeIssues related to the Sentry Node SDKIssues related to the Sentry Node SDK
Projects
Status
No status
