Skip to content

feat(nextjs)!: Remove experimental_captureRequestError #14607

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

Merged
merged 2 commits into from
Dec 10, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
"@trpc/react-query": "^11.0.0-rc.446",
"@trpc/server": "^11.0.0-rc.446",
"geist": "^1.3.0",
"next": "^14.2.4",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"next": "14.2.4",
"react": "18.3.1",
"react-dom": "18.3.1",
"server-only": "^0.0.1",
"superjson": "^2.2.1",
"zod": "^3.23.3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import 'server-only';

import { createHydrationHelpers } from '@trpc/react-query/rsc';
import { headers } from 'next/headers';
import { cache } from 'react';

import { type AppRouter, createCaller } from '~/server/api/root';
import { createTRPCContext } from '~/server/api/trpc';
Expand All @@ -12,16 +11,16 @@ import { createQueryClient } from './query-client';
* This wraps the `createTRPCContext` helper and provides the required context for the tRPC API when
* handling a tRPC call from a React Server Component.
*/
const createContext = cache(() => {
const createContext = () => {
const heads = new Headers(headers());
heads.set('x-trpc-source', 'rsc');

return createTRPCContext({
headers: heads,
});
});
};

const getQueryClient = cache(createQueryClient);
const getQueryClient = createQueryClient;
const caller = createCaller(createContext);

export const { trpc: api, HydrateClient } = createHydrationHelpers<AppRouter>(caller, getQueryClient);
8 changes: 0 additions & 8 deletions packages/nextjs/src/common/captureRequestError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,3 @@ export function captureRequestError(error: unknown, request: RequestInfo, errorC
});
});
}

/**
* Reports errors passed to the the Next.js `onRequestError` instrumentation hook.
*
* @deprecated Use `captureRequestError` instead.
*/
// TODO(v9): Remove this export
export const experimental_captureRequestError = captureRequestError;
3 changes: 1 addition & 2 deletions packages/nextjs/src/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@ export { wrapMiddlewareWithSentry } from './wrapMiddlewareWithSentry';
export { wrapPageComponentWithSentry } from './pages-router-instrumentation/wrapPageComponentWithSentry';
export { wrapGenerationFunctionWithSentry } from './wrapGenerationFunctionWithSentry';
export { withServerActionInstrumentation } from './withServerActionInstrumentation';
// eslint-disable-next-line deprecation/deprecation
export { experimental_captureRequestError, captureRequestError } from './captureRequestError';
export { captureRequestError } from './captureRequestError';
3 changes: 1 addition & 2 deletions packages/nextjs/src/index.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,5 +142,4 @@ export declare function wrapApiHandlerWithSentryVercelCrons<F extends (...args:
*/
export declare function wrapPageComponentWithSentry<C>(WrappingTarget: C): C;

// eslint-disable-next-line deprecation/deprecation
export { experimental_captureRequestError, captureRequestError } from './common/captureRequestError';
export { captureRequestError } from './common/captureRequestError';
Loading