Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(nextjs): Various DX improvements #2347

Merged
merged 5 commits into from
Dec 14, 2023
Merged

Conversation

nikosdouvlis
Copy link
Member

@nikosdouvlis nikosdouvlis commented Dec 14, 2023

Description

Drop support for NextJS v12: v12 was released on 26 Oct 2021. Support for security updates stopped on 21 Nov 2022.

Drop support for NextJS <13.0.4: Various header-related bugs were introduced with the 12.1.0, 12.2.0, 13.0.1, 13.0.2, 13.0.3 NextJS releases which are now fixed since next@^13.0.4. We will be dropping support for these problematic versions in order to greatly reduce complexity in our codebase.

Drop support for NextJS < 14.0.3 because of the issues described here: #1436.

Deprecate authMiddleware in favor of clerkMiddleware. For more information, see https://clerk.com/docs/upgrade-guides/v5-introduction

Move the server-side APIs from @clerk/nextjs to the @clerk/nextjs/server module: WebhookEventType, WebhookEvent, verifyToken, redirectToSignIn, auth, buildClerkProps, clerkClient, currentUser, getAuth, redirectToSignUp and authMiddleware. For more information, see https://clerk.com/docs/upgrade-guides/v5-introduction

Drop unused AuthStatus search param constant

SDK-787

Checklist

  • npm test runs as expected.
  • npm run build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 馃悰 Bug fix
  • 馃専 New feature
  • 馃敤 Breaking change
  • 馃摉 Refactoring / dependency upgrade / documentation
  • other:

Packages affected

  • @clerk/backend
  • @clerk/chrome-extension
  • @clerk/clerk-js
  • @clerk/clerk-expo
  • @clerk/fastify
  • gatsby-plugin-clerk
  • @clerk/localizations
  • @clerk/nextjs
  • @clerk/clerk-react
  • @clerk/remix
  • @clerk/clerk-sdk-node
  • @clerk/shared
  • @clerk/themes
  • @clerk/types
  • build/tooling/chore

Copy link

changeset-bot bot commented Dec 14, 2023

馃 Changeset detected

Latest commit: 84c1a31

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@clerk/nextjs Major
@clerk/backend Major
@clerk/fastify Patch
gatsby-plugin-clerk Patch
@clerk/remix Patch
@clerk/clerk-sdk-node Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@nikosdouvlis nikosdouvlis marked this pull request as ready for review December 14, 2023 11:50
@nikosdouvlis nikosdouvlis self-assigned this Dec 14, 2023
@dimkl dimkl added this pull request to the merge queue Dec 14, 2023
@nikosdouvlis nikosdouvlis removed this pull request from the merge queue due to a manual request Dec 14, 2023
Copy link
Member

@dimkl dimkl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

馃殌 馃殌 馃殌 馃殌 馃殌 馃殌 馃殌

packages/nextjs/src/server/index.ts Show resolved Hide resolved
* Generic exports
*/
export { verifyToken, createClerkClient } from '@clerk/backend';
export type { WebhookEvent, WebhookEventType } from '@clerk/backend';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After this PR only the following exported types will be available from the @clerk/backend : Organization, Session, User, WebhookEvent, WebhookEventType
We should export all those.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about the API types?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding a TODO, I will update the types in a 2nd PR right after

packages/nextjs/tsconfig.json Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

馃 I think this change is already applied in main by #2357

packages/nextjs/src/server/authMiddleware.ts Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

馃 There may be some conflicts with backend DX improvements PRs since these cleanups are also applied.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we reserve the https://clerk.com/docs/upgrade-guides/v5-introduction (without being searchable) and add a TODO or BETA text as a placeholder for those that may search the CHANGELOG and try to access the link?

Drop support for NextJS v12: v12 was released on 26 Oct 2021  (~2 years ago). Security support ended on 21 Nov 2022 (~11 months ago)

Drop support for NextJS <13.0.4: Many header-related bugs and breaking changes were introduced with the 12.1.0, 12.2.0, 13.0.1, 13.0.2, 13.0.3 releases. Vercel fixed all known related-bugs with version 13.0.4. In order to support every release in the range of 12 to 13.0.4 we had to resort to various workaround/compatibility layers (example https://github.com/clerk/javascript/blob/92727eec39566278263ffa118a085493f964eb94/packages/nextjs/src/server/utils.ts#L76). If we drop support for v12 and the other problematic versions, we can also remove all the extra logic from the @clerk/nextjs package

Drop support for NextJS < 14.0.3 for the issues described here: #1436
chore(repo): Add changesets

chore(repo): Update changesets
@nikosdouvlis nikosdouvlis merged commit e602d6c into main Dec 14, 2023
8 checks passed
@nikosdouvlis nikosdouvlis deleted the nikos/976-nextjs-dx branch December 14, 2023 23:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants