Skip to content

feat(nextjs): Various DX improvements#2347

Merged
nikosdouvlis merged 5 commits into
mainfrom
nikos/976-nextjs-dx
Dec 14, 2023
Merged

feat(nextjs): Various DX improvements#2347
nikosdouvlis merged 5 commits into
mainfrom
nikos/976-nextjs-dx

Conversation

@nikosdouvlis

@nikosdouvlis nikosdouvlis commented Dec 14, 2023

Copy link
Copy Markdown
Member

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

@changeset-bot

changeset-bot Bot commented Dec 14, 2023

Copy link
Copy Markdown

🦋 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
@nikosdouvlis nikosdouvlis force-pushed the nikos/976-nextjs-dx branch 6 times, most recently from 7044169 to 3e599f7 Compare December 14, 2023 22:26

@dimkl dimkl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🚀 🚀 🚀 🚀 🚀 🚀 🚀

Comment thread packages/nextjs/src/server/index.ts
* Generic exports
*/
export { verifyToken, createClerkClient } from '@clerk/backend';
export type { WebhookEvent, WebhookEventType } from '@clerk/backend';

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
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

Comment thread packages/nextjs/tsconfig.json

Copy link
Copy Markdown
Contributor

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

Comment thread packages/nextjs/src/server/authMiddleware.ts

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor

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
@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.

4 participants