Skip to content

Commit

Permalink
chore(nextjs): Warn about withServerSideAuth deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
dimkl committed Sep 22, 2023
1 parent fc59778 commit 94cc434
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/nextjs/src/ssr/withServerSideAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 94cc434

Please sign in to comment.