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 27, 2023
1 parent 9c88a2c commit 91930e0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/spicy-toys-change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@clerk/nextjs': patch
---

Warn about deprecations that will be dropped in next major version
5 changes: 5 additions & 0 deletions packages/nextjs/src/ssr/withServerSideAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
PUBLISHABLE_KEY,
sanitizeAuthObject,
} from '../server/clerkClient';
import { deprecated } from '../shared';
import type { WithServerSideAuthCallback, WithServerSideAuthOptions, WithServerSideAuthResult } from './types';
import { authenticateRequest, injectAuthIntoRequest, injectSSRStateIntoProps } from './utils';

Expand Down Expand Up @@ -43,6 +44,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 91930e0

Please sign in to comment.