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 28, 2023
1 parent 17ad6da commit 921892f
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
@@ -1,5 +1,6 @@
import type { RequestState } from '@clerk/backend';
import { constants, debugRequestState } from '@clerk/backend';
import { deprecated } from '@clerk/shared';
import type { ServerResponse } from 'http';
import type { GetServerSidePropsContext, GetServerSidePropsResult } from 'next';

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 921892f

Please sign in to comment.