diff --git a/packages/nextjs/src/ssr/withServerSideAuth.ts b/packages/nextjs/src/ssr/withServerSideAuth.ts index 28dfbb8ed5a..6577528cf97 100644 --- a/packages/nextjs/src/ssr/withServerSideAuth.ts +++ b/packages/nextjs/src/ssr/withServerSideAuth.ts @@ -12,6 +12,7 @@ import { JS_VERSION, PUBLISHABLE_KEY, } from '../server/constants'; +import { deprecated } from '../shared'; import type { WithServerSideAuthCallback, WithServerSideAuthOptions, WithServerSideAuthResult } from './types'; import { authenticateRequest, injectAuthIntoRequest, injectSSRStateIntoProps } from './utils'; @@ -41,6 +42,10 @@ const decorateResponseWithObservabilityHeaders = (res: ServerResponse, requestSt export const withServerSideAuth: WithServerSideAuth = (cbOrOptions: any, options?: any): any => { const cb = typeof cbOrOptions === 'function' ? cbOrOptions : undefined; const opts = (options ? options : typeof cbOrOptions !== 'function' ? cbOrOptions : {}) || {}; + deprecated( + 'withServerSideAuth', + 'Use `authMiddleware` instead.\nFor more details, consult the middleware documentation: https://clerk.com/docs/nextjs/middleware', + ); // Support both loadOrganization and the older loadOrg option without breaking changes // TODO: Remove pre v5