Skip to content

wrapSentryHandleRequest type mismatch with React Router middleware #17749

@wong2

Description

@wong2

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/react-router

SDK Version

10.14.0

Framework Version

React Router 7.9.1

Link to Sentry event

No response

Reproduction Example/SDK Setup

No response

Steps to Reproduce

I'm using wrapSentryHandleRequest to wrap my handler:

async function handleRequest(
  request: Request,
  responseStatusCode: number,
  responseHeaders: Headers,
  entryContext: EntryContext,
  routerContext: RouterContextProvider,
) {
  ...
}

export default wrapSentryHandleRequest(handleRequest)

Expected Result

No type error

Actual Result

Type error:

Argument of type '(request: Request, responseStatusCode: number, responseHeaders: Headers, entryContext: EntryContext, routerContext: RouterContextProvider) => Promise<...>' is not assignable to parameter of type 'OriginalHandleRequest'.
  Types of parameters 'routerContext' and 'loadContext' are incompatible.
    Type 'AppLoadContext' is missing the following properties from type 'RouterContextProvider': #private, get, setts(2345)

Additional Context

When the v8_middleware future flag is enabled, RouterContextProvider should be used instead of AppLoadContext

Tip: React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it.

Metadata

Metadata

Assignees

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions