Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tRPC v10 middleware type error #13857

Closed
3 tasks done
JoeKarow opened this issue Oct 2, 2024 · 2 comments · Fixed by #13859
Closed
3 tasks done

tRPC v10 middleware type error #13857

JoeKarow opened this issue Oct 2, 2024 · 2 comments · Fixed by #13859
Assignees
Labels
Package: nextjs Issues related to the Sentry Nextjs SDK

Comments

@JoeKarow
Copy link

JoeKarow commented Oct 2, 2024

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/nextjs

SDK Version

8.33.0

Framework Version

nextjs 14.2.14

Link to Sentry event

No response

Reproduction Example/SDK Setup

Related: #13795
Introduced in PR #13831

When upgrading Sentry from v8.32.0 to v8.33.0, I get this TypeScript error when initializing the tRPC middleware:
Image

It looks like this may be the culprit, causing a double wrapped promise for tRPC v10.

return async function <T>(opts: SentryTrpcMiddlewareArguments<T>): Promise<T> {

Steps to Reproduce

Add tRPC Sentry middleware.

Expected Result

No TypeScript errors.

Actual Result

Image

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Oct 2, 2024
@github-actions github-actions bot added the Package: nextjs Issues related to the Sentry Nextjs SDK label Oct 2, 2024
@chargome
Copy link
Member

chargome commented Oct 3, 2024

Hi @JoeKarow, we had to make the middleware async due to the changes in v11, you can update your code like this:

const sentryMiddleware = Sentry.trpcMiddleware({ attachRpcInput: true });

// and then wherever you attach it
const procedure = t.procedure.use(async opts => sentryMiddleware(opts));

EDIT: we'll update the types

Copy link
Contributor

github-actions bot commented Oct 3, 2024

A PR closing this issue has just been released 🚀

This issue was referenced by PR #13859, which was included in the 8.33.1 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: nextjs Issues related to the Sentry Nextjs SDK
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants