Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/node/src/integrations/tracing/fastify/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
import { generateInstrumentOnce } from '@sentry/node-core';
import { DEBUG_BUILD } from '../../../debug-build';
import { FastifyOtelInstrumentation } from './fastify-otel/index';
import type { FastifyInstance, FastifyReply, FastifyRequest } from './types';
import type { FastifyInstance, FastifyMinimal, FastifyReply, FastifyRequest } from './types';
import { FastifyInstrumentationV3 } from './v3/instrumentation';

/**
Expand Down Expand Up @@ -244,7 +244,7 @@ function defaultShouldHandleError(_error: Error, _request: FastifyRequest, reply
* app.listen({ port: 3000 });
* ```
*/
export function setupFastifyErrorHandler(fastify: FastifyInstance, options?: Partial<FastifyHandlerOptions>): void {
export function setupFastifyErrorHandler(fastify: FastifyMinimal, options?: Partial<FastifyHandlerOptions>): void {
if (options?.shouldHandleError) {
getFastifyIntegration()?.setShouldHandleError(options.shouldHandleError);
}
Expand Down
9 changes: 9 additions & 0 deletions packages/node/src/integrations/tracing/fastify/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ export interface FastifyInstance {
addHook(hook: 'onRequest', handler: (request: FastifyRequest, reply: FastifyReply) => void): FastifyInstance;
}

/**
* Minimal type for `setupFastifyErrorHandler` parameter.
* Uses structural typing without overloads to avoid exactOptionalPropertyTypes issues.
* https://github.com/getsentry/sentry-javascript/issues/18619
*/
export type FastifyMinimal = {
register: (plugin: (instance: any, opts: any, done: () => void) => void) => unknown;
};

export interface FastifyReply {
send: () => FastifyReply;
statusCode: number;
Expand Down
Loading