@clerk/upgrade 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/guide-generators/text-generation.js +109 -0
- package/dist/guide-generators/v5/backend/__output.mdx +580 -0
- package/dist/guide-generators/v5/backend/import-moves.mdx +3 -0
- package/dist/guide-generators/v5/backend/import-paths.mdx +3 -0
- package/dist/guide-generators/v5/backend/index.js +22 -0
- package/dist/guide-generators/v5/backend/intro.mdx +3 -0
- package/dist/guide-generators/v5/chrome-extension/index.js +19 -0
- package/dist/guide-generators/v5/chrome-extension/intro.mdx +3 -0
- package/dist/guide-generators/v5/chromeExtension/__output.mdx +409 -0
- package/dist/guide-generators/v5/chromeExtension/index.js +24 -0
- package/dist/guide-generators/v5/chromeExtension/intro.mdx +3 -0
- package/dist/guide-generators/v5/expo/__output.mdx +455 -0
- package/dist/guide-generators/v5/expo/index.js +24 -0
- package/dist/guide-generators/v5/expo/intro.mdx +3 -0
- package/dist/guide-generators/v5/fastify/__output.mdx +373 -0
- package/dist/guide-generators/v5/fastify/index.js +22 -0
- package/dist/guide-generators/v5/fastify/intro.mdx +3 -0
- package/dist/guide-generators/v5/gatsby/__output.mdx +472 -0
- package/dist/guide-generators/v5/gatsby/index.js +24 -0
- package/dist/guide-generators/v5/gatsby/intro.mdx +3 -0
- package/dist/guide-generators/v5/generate-all.js +0 -0
- package/dist/guide-generators/v5/generate-all.sh +16 -0
- package/dist/guide-generators/v5/generate.js +263 -0
- package/dist/guide-generators/v5/intro.mdx +15 -0
- package/dist/guide-generators/v5/js/__output.mdx +528 -0
- package/dist/guide-generators/v5/js/index.js +27 -0
- package/dist/guide-generators/v5/js/intro.mdx +3 -0
- package/dist/guide-generators/v5/js/pagination-args.mdx +3 -0
- package/dist/guide-generators/v5/js/pagination-return.mdx +3 -0
- package/dist/guide-generators/v5/nextjs/__output.mdx +1091 -0
- package/dist/guide-generators/v5/nextjs/after-sign-x-handling.mdx +10 -0
- package/dist/guide-generators/v5/nextjs/deprecation-removals.mdx +9 -0
- package/dist/guide-generators/v5/nextjs/import-changes.mdx +98 -0
- package/dist/guide-generators/v5/nextjs/index.js +24 -0
- package/dist/guide-generators/v5/nextjs/intro.mdx +3 -0
- package/dist/guide-generators/v5/nextjs/middleware-changes.mdx +251 -0
- package/dist/guide-generators/v5/nextjs/nextjs-versio.mdx +34 -0
- package/dist/guide-generators/v5/nextjs/nextjs-version.mdx +6 -0
- package/dist/guide-generators/v5/nextjs/retheme-changes.mdx +10 -0
- package/dist/guide-generators/v5/nextjs/version-requirements.mdx +34 -0
- package/dist/guide-generators/v5/node/__output.mdx +511 -0
- package/dist/guide-generators/v5/node/index.js +22 -0
- package/dist/guide-generators/v5/node/intro.mdx +3 -0
- package/dist/guide-generators/v5/node/node-setters-removals.mdx +34 -0
- package/dist/guide-generators/v5/overview/__output.mdx +37 -0
- package/dist/guide-generators/v5/overview/index.js +12 -0
- package/dist/guide-generators/v5/overview/intro.mdx +31 -0
- package/dist/guide-generators/v5/overview/per-sdk.mdx +16 -0
- package/dist/guide-generators/v5/per-sdk.mdx +16 -0
- package/dist/guide-generators/v5/prepare.mdx +135 -0
- package/dist/guide-generators/v5/react/__output.mdx +679 -0
- package/dist/guide-generators/v5/react/hof-removals.mdx +3 -0
- package/dist/guide-generators/v5/react/index.js +24 -0
- package/dist/guide-generators/v5/react/intro.mdx +3 -0
- package/dist/guide-generators/v5/redesigned-components.mdx +11 -0
- package/dist/guide-generators/v5/remix/__output.mdx +401 -0
- package/dist/guide-generators/v5/remix/index.js +24 -0
- package/dist/guide-generators/v5/remix/intro.mdx +3 -0
- package/dist/guide-generators/v5/retheme/__output.mdx +437 -0
- package/dist/guide-generators/v5/retheme/index.js +24 -0
- package/dist/guide-generators/v5/retheme/intro.mdx +9 -0
- package/dist/guide-generators/v5/shared/after-sign-x-handling.mdx +10 -0
- package/dist/guide-generators/v5/shared/cli.mdx +22 -0
- package/dist/guide-generators/v5/shared/deprecation-removals.mdx +6 -0
- package/dist/guide-generators/v5/shared/hof-removals.mdx +3 -0
- package/dist/guide-generators/v5/shared/image-url.mdx +3 -0
- package/dist/guide-generators/v5/shared/node-setters-removals.mdx +34 -0
- package/dist/guide-generators/v5/shared/node-version.mdx +3 -0
- package/dist/guide-generators/v5/shared/orgs-claim.mdx +50 -0
- package/dist/guide-generators/v5/shared/pagination-args.mdx +3 -0
- package/dist/guide-generators/v5/shared/pagination-return.mdx +3 -0
- package/dist/guide-generators/v5/shared/path-routing.mdx +57 -0
- package/dist/guide-generators/v5/shared/prepare.mdx +10 -0
- package/dist/guide-generators/v5/shared/react-version.mdx +20 -0
- package/dist/guide-generators/v5/shared/redesign-preview.mdx +5 -0
- package/dist/guide-generators/v5/shared/update-v5.mdx +17 -0
- package/dist/guide-generators/v5/shared/update-version.mdx +18 -0
- package/dist/guide-generators/v5/single-page-old.js +192 -0
- package/dist/guide-generators/v5-guides/deprecation-removals.mdx +7 -0
- package/dist/guide-generators/v5-guides/generate.js +263 -0
- package/dist/guide-generators/v5-guides/hof-removals.mdx +3 -0
- package/dist/guide-generators/v5-guides/intro.mdx +15 -0
- package/dist/guide-generators/v5-guides/nextjs/after-sign-x-handling.mdx +10 -0
- package/dist/guide-generators/v5-guides/nextjs/deprecation-removals.mdx +9 -0
- package/dist/guide-generators/v5-guides/nextjs/import-changes.mdx +98 -0
- package/dist/guide-generators/v5-guides/nextjs/index.js +80 -0
- package/dist/guide-generators/v5-guides/nextjs/intro.mdx +21 -0
- package/dist/guide-generators/v5-guides/nextjs/middleware-changes.mdx +251 -0
- package/dist/guide-generators/v5-guides/nextjs/retheme-changes.mdx +10 -0
- package/dist/guide-generators/v5-guides/nextjs/version-requirements.mdx +34 -0
- package/dist/guide-generators/v5-guides/node-setters-removals.mdx +34 -0
- package/dist/guide-generators/v5-guides/pagination-args.mdx +3 -0
- package/dist/guide-generators/v5-guides/pagination-return.mdx +3 -0
- package/dist/guide-generators/v5-guides/path-routing.mdx +50 -0
- package/dist/guide-generators/v5-guides/per-sdk.mdx +16 -0
- package/dist/guide-generators/v5-guides/prepare.mdx +135 -0
- package/dist/guide-generators/v5-guides/redesign-preview.mdx +5 -0
- package/dist/guide-generators/v5-guides/redesigned-components.mdx +11 -0
- package/dist/guide-generators/v5-guides/remix/index.js +15 -0
- package/dist/guide-generators/v5-guides/remix/intro.mdx +1 -0
- package/dist/guide-generators/v5-guides/remix/output.mdx +362 -0
- package/dist/guide-generators/v5-guides/shared/breaking-changes-intro.mdx +0 -0
- package/dist/guide-generators/v5-guides/shared/cli.mdx +21 -0
- package/dist/guide-generators/v5-guides/shared/deprecation-removals.mdx +7 -0
- package/dist/guide-generators/v5-guides/shared/hof-removals.mdx +3 -0
- package/dist/guide-generators/v5-guides/shared/node-setters-removals.mdx +34 -0
- package/dist/guide-generators/v5-guides/shared/node-version.mdx +3 -0
- package/dist/guide-generators/v5-guides/shared/pagination-args.mdx +3 -0
- package/dist/guide-generators/v5-guides/shared/pagination-return.mdx +3 -0
- package/dist/guide-generators/v5-guides/shared/path-routing.mdx +50 -0
- package/dist/guide-generators/v5-guides/shared/prepare.mdx +7 -0
- package/dist/guide-generators/v5-guides/shared/react-version.mdx +19 -0
- package/dist/guide-generators/v5-guides/shared/redesign-preview.mdx +5 -0
- package/dist/guide-generators/v5-guides/shared/update-v5.mdx +17 -0
- package/dist/guide-generators/v5-guides/shared/upgrade-v5.mdx +17 -0
- package/dist/scan.js +4 -2
- package/dist/util/generate-nextjs-migration-guide.js +0 -0
- package/dist/util/generate-nextjs-v5-migration-guide.js +0 -0
- package/dist/util/load-change.js +1 -0
- package/dist/util/text-generation.js +29 -0
- package/dist/util/v5-guide/deprecation-removals.mdx +7 -0
- package/dist/util/v5-guide/generate.js +200 -0
- package/dist/util/v5-guide/getting-up-to-date.mdx +114 -0
- package/dist/util/v5-guide/hof-removals.mdx +3 -0
- package/dist/util/v5-guide/intro.mdx +15 -0
- package/dist/util/v5-guide/node-setters-removals.mdx +34 -0
- package/dist/util/v5-guide/pagination-args.mdx +3 -0
- package/dist/util/v5-guide/pagination-return.mdx +3 -0
- package/dist/util/v5-guide/path-routing.mdx +50 -0
- package/dist/util/v5-guide/per-sdk.mdx +16 -0
- package/dist/util/v5-guide/prepare.mdx +135 -0
- package/dist/util/v5-guide/redesign-preview.mdx +5 -0
- package/dist/util/v5-guide/redesigned-components.mdx +11 -0
- package/dist/util/v5-guide/remix.mdx +0 -0
- package/dist/util/v5-guides/deprecation-removals.mdx +7 -0
- package/dist/util/v5-guides/generate.js +200 -0
- package/dist/util/v5-guides/hof-removals.mdx +3 -0
- package/dist/util/v5-guides/intro.mdx +15 -0
- package/dist/util/v5-guides/nextjs/after-sign-x-handling.mdx +10 -0
- package/dist/util/v5-guides/nextjs/deprecation-removals.mdx +9 -0
- package/dist/util/v5-guides/nextjs/generate.js +80 -0
- package/dist/util/v5-guides/nextjs/import-changes.mdx +98 -0
- package/dist/util/v5-guides/nextjs/index.js +0 -0
- package/dist/util/v5-guides/nextjs/intro.mdx +21 -0
- package/dist/util/v5-guides/nextjs/middleware-changes.mdx +251 -0
- package/dist/util/v5-guides/nextjs/retheme-changes.mdx +10 -0
- package/dist/util/v5-guides/nextjs/version-requirements.mdx +34 -0
- package/dist/util/v5-guides/node-setters-removals.mdx +34 -0
- package/dist/util/v5-guides/pagination-args.mdx +3 -0
- package/dist/util/v5-guides/pagination-return.mdx +3 -0
- package/dist/util/v5-guides/path-routing.mdx +50 -0
- package/dist/util/v5-guides/per-sdk.mdx +16 -0
- package/dist/util/v5-guides/prepare.mdx +135 -0
- package/dist/util/v5-guides/redesign-preview.mdx +5 -0
- package/dist/util/v5-guides/redesigned-components.mdx +11 -0
- package/dist/util/v5-guides/remix/index.js +5 -0
- package/dist/util/v5-nextjs-guide/after-sign-x-handling.mdx +10 -0
- package/dist/util/v5-nextjs-guide/deprecation-removals.mdx +9 -0
- package/dist/util/v5-nextjs-guide/generate-nextjs-v5-migration-guide.js +0 -0
- package/dist/util/v5-nextjs-guide/generate.js +80 -0
- package/dist/util/v5-nextjs-guide/import-changes.mdx +98 -0
- package/dist/util/v5-nextjs-guide/intro.md +0 -0
- package/dist/util/v5-nextjs-guide/intro.mdx +21 -0
- package/dist/util/v5-nextjs-guide/middleware-changes.mdx +251 -0
- package/dist/util/v5-nextjs-guide/retheme-changes.mdx +11 -0
- package/dist/util/v5-nextjs-guide/version-requirements.mdx +34 -0
- package/dist/versions/v5/backend/appearance-organizationpreview-organizationswitcher.md +9 -0
- package/dist/versions/v5/backend/authenticaterequest-params-change.md +1 -0
- package/dist/versions/v5/backend/clockskewinseconds.md +1 -0
- package/dist/versions/v5/backend/constants-import-path-move.md +1 -0
- package/dist/versions/v5/backend/createauthenticaterequest-import-path-move.md +1 -0
- package/dist/versions/v5/backend/createclerkclient-apikey.md +1 -0
- package/dist/versions/v5/backend/createclerkclient-frontendapi.md +1 -0
- package/dist/versions/v5/backend/createisomorphicrequest-import-path-move.md +1 -0
- package/dist/versions/v5/backend/createisomorphicrequest-removed.md +1 -0
- package/dist/versions/v5/backend/decodejwt-import-path-move.md +1 -0
- package/dist/versions/v5/backend/externalaccount-picture.md +1 -0
- package/dist/versions/v5/backend/externalaccountjson-avatarurl.md +1 -0
- package/dist/versions/v5/backend/getorganizationinvitationlist-return-signature.md +1 -0
- package/dist/versions/v5/backend/getorganizationinvitationlist-return-type-change.md +17 -0
- package/dist/versions/v5/backend/getorganizationlist-return-signature.md +1 -0
- package/dist/versions/v5/backend/getorganizationmembershiplist-return-signature.md +1 -0
- package/dist/versions/v5/backend/httpoptions-removed.md +2 -1
- package/dist/versions/v5/backend/organizationjson-logourl.md +1 -0
- package/dist/versions/v5/backend/organizationmembershippublicuserdatajson-profileimageurl.md +1 -0
- package/dist/versions/v5/backend/redirect-import-path-move.md +1 -0
- package/dist/versions/v5/backend/signjwt-import-path-move.md +1 -0
- package/dist/versions/v5/backend/signjwterror-import-move.md +1 -0
- package/dist/versions/v5/backend/tokenverificationerror-import-move.md +1 -0
- package/dist/versions/v5/backend/tokenverificationerroraction-import-move.md +1 -0
- package/dist/versions/v5/backend/tokenverificationerrorcode-import-move.md +1 -0
- package/dist/versions/v5/backend/tokenverificationerrorreason-import-move.md +1 -0
- package/dist/versions/v5/backend/userjson-profileimageurl.md +1 -0
- package/dist/versions/v5/backend/verifyjwt-import-path-move.md +1 -0
- package/dist/versions/v5/chromeExtension/clerkprovider-tokencache.md +8 -10
- package/dist/versions/v5/common/aftersigninurl-behavior-change-2.md +1 -0
- package/dist/versions/v5/common/aftersignouturl-behavior-change.md +1 -0
- package/dist/versions/v5/common/aftersignupurl-behavior-change.md +1 -0
- package/dist/versions/v5/common/afterswitchorganizationurl.md +1 -0
- package/dist/versions/v5/common/alternativemethods-backlink.md +1 -0
- package/dist/versions/v5/common/api-key-to-secret-key.md +1 -0
- package/dist/versions/v5/common/appearance-organizationpreview-organizationswitcher.md +1 -0
- package/dist/versions/v5/common/button-to-organizationlistcreateorganizationactionbutton.md +1 -0
- package/dist/versions/v5/common/card-changes.md +3 -2
- package/dist/versions/v5/common/changed-localization-keys.md +121 -120
- package/dist/versions/v5/common/clerkprovider-frontendapi-2.md +1 -0
- package/dist/versions/v5/common/clerkprovideroptionswrapper-dropped.md +1 -0
- package/dist/versions/v5/common/connected-accounts-dropdown.md +1 -0
- package/dist/versions/v5/common/emaillinkerrorcode-import-change.md +1 -0
- package/dist/versions/v5/common/externalaccount-avatarurl.md +7 -0
- package/dist/versions/v5/common/externalaccount-picture.md +7 -0
- package/dist/versions/v5/common/externalaccountjson-avatarurl.md +7 -0
- package/dist/versions/v5/common/frontend-api-to-publishable-key.md +1 -0
- package/dist/versions/v5/common/getorganizationinvitationlist-return-signature.md +15 -0
- package/dist/versions/v5/common/getorganizationinvitationlist-return-type-change.md +8 -5
- package/dist/versions/v5/common/getorganizationlist-return-signature.md +15 -0
- package/dist/versions/v5/common/getorganizationlist-return-type-change.md +2 -1
- package/dist/versions/v5/common/getorganizationmembershiplist-return-type-change.md +2 -1
- package/dist/versions/v5/common/isclerkapiresponserror-import-change.md +1 -0
- package/dist/versions/v5/common/isemaillinkerror-import-change.md +1 -0
- package/dist/versions/v5/common/isknownerror-import-change.md +1 -0
- package/dist/versions/v5/common/ismetamaskerror-import-change.md +6 -5
- package/dist/versions/v5/common/mfa-dropdown.md +1 -0
- package/dist/versions/v5/common/min-react-version.md +2 -0
- package/dist/versions/v5/common/multisessionappsupport-import-change.md +1 -1
- package/dist/versions/v5/common/navigate-to-routerpush-routerreplace.md +1 -0
- package/dist/versions/v5/common/new-localization-keys.md +121 -120
- package/dist/versions/v5/common/organization-create-string.md +12 -0
- package/dist/versions/v5/common/organization-getdomains-arguments-change.md +1 -0
- package/dist/versions/v5/common/organization-getinvitations-arguments-changed.md +1 -0
- package/dist/versions/v5/common/organization-getmembershiprequests-arguments-changed.md +1 -0
- package/dist/versions/v5/common/organization-getmemberships-arguments-changed.md +1 -0
- package/dist/versions/v5/common/organization-getpendinginvitations.md +11 -0
- package/dist/versions/v5/common/organization-getroles-arguments-changed.md +1 -0
- package/dist/versions/v5/common/organization-logourl.md +8 -0
- package/dist/versions/v5/common/organizationmembershippublicuserdata-profileimageurl.md +7 -0
- package/dist/versions/v5/common/organizationprofile-settings.md +1 -0
- package/dist/versions/v5/common/organizationswitcherpopoveractionbuttontext-removed.md +1 -0
- package/dist/versions/v5/common/remove-identitypreview-avatar.md +1 -0
- package/dist/versions/v5/common/remove-socialbuttonsblockbuttonarrow.md +1 -0
- package/dist/versions/v5/common/removed-localization-keys.md +74 -73
- package/dist/versions/v5/common/user-getorganizationinvitations-arguments-chanaged.md +1 -0
- package/dist/versions/v5/common/user-getorganizationinvitations-arguments-changed.md +16 -0
- package/dist/versions/v5/common/user-getorganizationmemberships-arguments-chanaged.md +1 -0
- package/dist/versions/v5/common/user-getorganizationmemberships-arguments-changed.md +16 -0
- package/dist/versions/v5/common/user-getorganizationsuggestions-arguments-chanaged.md +1 -0
- package/dist/versions/v5/common/user-getorganizationsuggestions-arguments-changed.md +16 -0
- package/dist/versions/v5/common/user-profileimageurl.md +7 -0
- package/dist/versions/v5/common/user-update-password.md +18 -0
- package/dist/versions/v5/common/userbuttonpopoveractionbuttontext-removed.md +1 -0
- package/dist/versions/v5/common/userbuttontrigger-userbuttonbox-invert.md +2 -1
- package/dist/versions/v5/common/userprofile-security.md +1 -0
- package/dist/versions/v5/common/withclerk-hof-removed.md +15 -14
- package/dist/versions/v5/common/withclerk-removed.md +1 -0
- package/dist/versions/v5/common/withsession-hof-removed.md +15 -14
- package/dist/versions/v5/common/withsession-removed.md +1 -0
- package/dist/versions/v5/common/withuser-hof-removed.md +15 -14
- package/dist/versions/v5/common/withuser-removed-2.md +1 -2
- package/dist/versions/v5/expo/apikey-to-publishable-key.md +1 -0
- package/dist/versions/v5/expo/clerkprovider-frontendapi.md +1 -0
- package/dist/versions/v5/fastify/clerkplugin-frontendapi.md +2 -1
- package/dist/versions/v5/fastify/createclerkclient-apikey.md +1 -0
- package/dist/versions/v5/fastify/createclerkclient-frontendapi.md +1 -0
- package/dist/versions/v5/gatsby/api-url-value-change.md +1 -1
- package/dist/versions/v5/gatsby/apikey-to-publishable-key.md +1 -0
- package/dist/versions/v5/gatsby/createclerkclient-apikey.md +1 -0
- package/dist/versions/v5/gatsby/createclerkclient-frontendapi.md +1 -0
- package/dist/versions/v5/gatsby/withserverauth-return-type.md +22 -30
- package/dist/versions/v5/index.js +16 -26
- package/dist/versions/v5/js/experimental-canusecaptcha.md +1 -0
- package/dist/versions/v5/js/experimental-captchasitekey.md +1 -0
- package/dist/versions/v5/js/experimental-captchaurl.md +1 -0
- package/dist/versions/v5/js/getorganizationmemberships.md +3 -6
- package/dist/versions/v5/js/redirecttohome.md +4 -4
- package/dist/versions/v5/js/signup-attemptweb3walletverification-generatedsignature.md +3 -2
- package/dist/versions/v5/js/unstable-invitationupdate.md +1 -0
- package/dist/versions/v5/js/unstable-membershipupdate.md +1 -0
- package/dist/versions/v5/js/user-createexternalaccount-redirecturl.md +1 -0
- package/dist/versions/v5/js/user-update-password.md +8 -9
- package/dist/versions/v5/next/auth-import-change.md +1 -0
- package/dist/versions/v5/next/auth-middleware-deprecated.md +8 -7
- package/dist/versions/v5/next/authmiddleware-apikey.md +5 -7
- package/dist/versions/v5/next/authmiddleware-frontendapi.md +2 -1
- package/dist/versions/v5/next/authmiddleware-import-change.md +1 -0
- package/dist/versions/v5/next/buildclerkprops-import-change.md +1 -0
- package/dist/versions/v5/next/clerk-import-change.md +1 -0
- package/dist/versions/v5/next/clerk-js-version-next-public.md +1 -0
- package/dist/versions/v5/next/constants-import-change.md +2 -1
- package/dist/versions/v5/next/createauthenticaterequest-import-change.md +1 -0
- package/dist/versions/v5/next/createclerkclient-apikey.md +2 -1
- package/dist/versions/v5/next/createclerkclient-frontendapi.md +2 -1
- package/dist/versions/v5/next/createisomorphicrequest-import-change.md +1 -0
- package/dist/versions/v5/next/currentuser-import-change.md +1 -0
- package/dist/versions/v5/next/decodejwt-import-change.md +1 -0
- package/dist/versions/v5/next/emaillinkerrorcode-import-change.md +1 -0
- package/dist/versions/v5/next/getauth-apikey.md +2 -1
- package/dist/versions/v5/next/import-api-url.md +2 -1
- package/dist/versions/v5/next/import-api-version.md +2 -1
- package/dist/versions/v5/next/import-clerk-js-url.md +2 -1
- package/dist/versions/v5/next/import-clerk-js-version.md +2 -1
- package/dist/versions/v5/next/import-domain.md +2 -1
- package/dist/versions/v5/next/import-is-satellite.md +2 -1
- package/dist/versions/v5/next/import-nextjs-api.md +7 -6
- package/dist/versions/v5/next/import-nextjs-app-beta.md +2 -1
- package/dist/versions/v5/next/import-nextjs-edge-middleware.md +1 -0
- package/dist/versions/v5/next/import-nextjs-edge-middlewarefiles.md +1 -0
- package/dist/versions/v5/next/import-nextjs-ssr.md +1 -0
- package/dist/versions/v5/next/import-proxy-url.md +2 -1
- package/dist/versions/v5/next/import-publishable-key.md +2 -1
- package/dist/versions/v5/next/import-secret-key.md +2 -1
- package/dist/versions/v5/next/import-sign-in-url.md +2 -1
- package/dist/versions/v5/next/import-sign-up-url.md +2 -1
- package/dist/versions/v5/next/isclerkapiresponserror-import-change.md +1 -0
- package/dist/versions/v5/next/isemaillinkerror-import-change.md +1 -0
- package/dist/versions/v5/next/isknownerror-import-change.md +1 -0
- package/dist/versions/v5/next/ismetamaskerror-import-change.md +1 -0
- package/dist/versions/v5/next/min-nextjs-version.md +2 -0
- package/dist/versions/v5/next/multisessionappsupport-import-change.md +1 -0
- package/dist/versions/v5/next/next-public-clerk-js-url.md +2 -1
- package/dist/versions/v5/next/redirect-import-change.md +1 -0
- package/dist/versions/v5/next/redirecttosignin-import-path.md +2 -1
- package/dist/versions/v5/next/redirecttosignup-import-path.md +2 -1
- package/dist/versions/v5/next/signjwt-import-change.md +1 -0
- package/dist/versions/v5/next/verifyjwt-import-change.md +1 -0
- package/dist/versions/v5/next/verifytoken-import-change.md +1 -0
- package/dist/versions/v5/next/with-clerk-middleware-removed.md +1 -0
- package/dist/versions/v5/nextjs/api-url-value-change.md +8 -0
- package/dist/versions/v5/nextjs/auth-import-change.md +14 -0
- package/dist/versions/v5/nextjs/auth-middleware-deprecated.md +50 -0
- package/dist/versions/v5/nextjs/authmiddleware-apikey.md +15 -0
- package/dist/versions/v5/nextjs/authmiddleware-frontendapi.md +15 -0
- package/dist/versions/v5/nextjs/authmiddleware-import-change.md +14 -0
- package/dist/versions/v5/nextjs/buildclerkprops-import-change.md +14 -0
- package/dist/versions/v5/nextjs/clerk-import-change.md +13 -0
- package/dist/versions/v5/nextjs/clerk-js-version-next-public.md +9 -0
- package/dist/versions/v5/nextjs/constants-import-change.md +14 -0
- package/dist/versions/v5/nextjs/createauthenticaterequest-import-change.md +14 -0
- package/dist/versions/v5/nextjs/createclerkclient-apikey.md +15 -0
- package/dist/versions/v5/nextjs/createclerkclient-frontendapi.md +15 -0
- package/dist/versions/v5/nextjs/createisomorphicrequest-import-change.md +14 -0
- package/dist/versions/v5/nextjs/currentuser-import-change.md +14 -0
- package/dist/versions/v5/nextjs/decodejwt-import-change.md +14 -0
- package/dist/versions/v5/nextjs/emaillinkerrorcode-import-change.md +14 -0
- package/dist/versions/v5/nextjs/getauth-apikey.md +13 -0
- package/dist/versions/v5/nextjs/import-api-url.md +8 -0
- package/dist/versions/v5/nextjs/import-api-version.md +8 -0
- package/dist/versions/v5/nextjs/import-clerk-js-url.md +8 -0
- package/dist/versions/v5/nextjs/import-clerk-js-version.md +8 -0
- package/dist/versions/v5/nextjs/import-domain.md +8 -0
- package/dist/versions/v5/nextjs/import-is-satellite.md +8 -0
- package/dist/versions/v5/nextjs/import-nextjs-api.md +21 -0
- package/dist/versions/v5/nextjs/import-nextjs-app-beta.md +11 -0
- package/dist/versions/v5/nextjs/import-nextjs-edge-middleware.md +7 -0
- package/dist/versions/v5/nextjs/import-nextjs-edge-middlewarefiles.md +7 -0
- package/dist/versions/v5/nextjs/import-nextjs-ssr.md +8 -0
- package/dist/versions/v5/nextjs/import-proxy-url.md +8 -0
- package/dist/versions/v5/nextjs/import-publishable-key.md +8 -0
- package/dist/versions/v5/nextjs/import-secret-key.md +8 -0
- package/dist/versions/v5/nextjs/import-sign-in-url.md +8 -0
- package/dist/versions/v5/nextjs/import-sign-up-url.md +8 -0
- package/dist/versions/v5/nextjs/isclerkapiresponserror-import-change.md +14 -0
- package/dist/versions/v5/nextjs/isemaillinkerror-import-change.md +14 -0
- package/dist/versions/v5/nextjs/isknownerror-import-change.md +14 -0
- package/dist/versions/v5/nextjs/min-nextjs-version.md +11 -0
- package/dist/versions/v5/nextjs/multisessionappsupport-import-change.md +14 -0
- package/dist/versions/v5/nextjs/next-public-clerk-js-url.md +7 -0
- package/dist/versions/v5/nextjs/redirect-import-change.md +14 -0
- package/dist/versions/v5/nextjs/redirecttosignin-import-path.md +13 -0
- package/dist/versions/v5/nextjs/redirecttosignup-import-path.md +13 -0
- package/dist/versions/v5/nextjs/signjwt-import-change.md +14 -0
- package/dist/versions/v5/nextjs/verifyjwt-import-change.md +14 -0
- package/dist/versions/v5/nextjs/verifytoken-import-change.md +14 -0
- package/dist/versions/v5/nextjs/with-clerk-middleware-removed.md +56 -0
- package/dist/versions/v5/node/cjs-esm-instance.md +1 -0
- package/dist/versions/v5/node/clerkexpressrequireauth-apikey.md +1 -0
- package/dist/versions/v5/node/clerkexpressrequireauth-frontendapi.md +1 -0
- package/dist/versions/v5/node/clerkexpresswithauth-apikey.md +1 -0
- package/dist/versions/v5/node/clerkexpresswithauth-frontendapi.md +1 -0
- package/dist/versions/v5/node/createclerkclient-apikey.md +1 -0
- package/dist/versions/v5/node/createclerkclient-frontendapi.md +1 -0
- package/dist/versions/v5/node/createclerkexpressrequireauth-apikey.md +1 -0
- package/dist/versions/v5/node/createclerkexpressrequireauth-frontendapi.md +1 -0
- package/dist/versions/v5/node/createclerkexpresswithauth-apikey.md +1 -0
- package/dist/versions/v5/node/createclerkexpresswithauth-frontendapi.md +1 -0
- package/dist/versions/v5/node/legacyauthobject-removed.md +3 -3
- package/dist/versions/v5/node/setclerkapikey.md +1 -0
- package/dist/versions/v5/node/setclerkapiversion.md +1 -0
- package/dist/versions/v5/node/setclerkhttpoptions.md +1 -0
- package/dist/versions/v5/node/setclerkserverapiurl.md +1 -0
- package/dist/versions/v5/react/api-url-value-change.md +1 -1
- package/dist/versions/v5/remix/clerk-import-change.md +1 -0
- package/dist/versions/v5/remix/clerkerrorboundary-removed.md +1 -0
- package/dist/versions/v5/remix/createclerkclient-apikey.md +1 -0
- package/dist/versions/v5/remix/getauth-apikey.md +1 -0
- package/dist/versions/v5/remix/rootauthloader-apikey.md +1 -0
- package/dist/versions/v5/remix/rootauthloader-frontendapi.md +1 -0
- package/package.json +5 -2
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
## Changes to top-level exports
|
|
2
|
+
|
|
3
|
+
As part of this release, some of the top-level exports of `@clerk/nextjs` have been changed in order to improve bundle size and tree-shaking efficiency. These changes have resulted in a ~75% reduction in build size for middleware bundles. However, you will likely need to make some changes to import paths as a result.
|
|
4
|
+
|
|
5
|
+
<Callout type='info'>
|
|
6
|
+
Use the CLI tool, `npx @clerk/upgrade`, to automatically find occurences of old imports.
|
|
7
|
+
</Callout>
|
|
8
|
+
|
|
9
|
+
<Accordion titles={["@clerk/nextjs/server", "@clerk/nextjs/errors", "@clerk/nextjs/app-beta", "@clerk/nextjs/ssr", "@clerk/nextjs/edge-middleware", "@clerk/nextjs/edge-middlewarefiles", "@clerk/nextjs/api"]} heading="h4">
|
|
10
|
+
<AccordionPanel>
|
|
11
|
+
Previously these exports have been exported both from `@clerk/nextjs` and `@clerk/nextjs/server`. As of v5 they are only exported from the latter.
|
|
12
|
+
|
|
13
|
+
```diff
|
|
14
|
+
import {
|
|
15
|
+
auth,
|
|
16
|
+
currentUser,
|
|
17
|
+
authMiddleware,
|
|
18
|
+
buildClerkProps,
|
|
19
|
+
verifyToken,
|
|
20
|
+
verifyJwt,
|
|
21
|
+
decodeJwt,
|
|
22
|
+
signJwt,
|
|
23
|
+
constants,
|
|
24
|
+
redirect,
|
|
25
|
+
createAuthenticateRequest,
|
|
26
|
+
createIsomorphicRequest,
|
|
27
|
+
- } from "@clerk/nextjs"
|
|
28
|
+
+ } from "@clerk/nextjs/server"
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
</AccordionPanel>
|
|
32
|
+
<AccordionPanel>
|
|
33
|
+
Exports related to errors are now under `@clerk/nextjs/errors`.
|
|
34
|
+
|
|
35
|
+
```diff
|
|
36
|
+
import {
|
|
37
|
+
isClerkAPIResponseError,
|
|
38
|
+
isEmailLinkError,
|
|
39
|
+
isKnownError,
|
|
40
|
+
isMetamaskError,
|
|
41
|
+
EmailLinkErrorCode,
|
|
42
|
+
- } from "@clerk/nextjs"
|
|
43
|
+
+ } from "@clerk/nextjs/errors"
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
</AccordionPanel>
|
|
47
|
+
<AccordionPanel>
|
|
48
|
+
The `@clerk/nextjs` import will work with both the app and pages router.
|
|
49
|
+
|
|
50
|
+
```diff
|
|
51
|
+
- import { } from "@clerk/nextjs/app-beta"
|
|
52
|
+
+ import { } from "@clerk/nextjs"
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Some behavior may have changed between Clerk's beta and the stable release. Please check on your end if behavior stayed the same.
|
|
56
|
+
|
|
57
|
+
</AccordionPanel>
|
|
58
|
+
<AccordionPanel>
|
|
59
|
+
The top-level exports support SSR by default now.
|
|
60
|
+
|
|
61
|
+
```diff
|
|
62
|
+
- import { } from "@clerk/nextjs/ssr"
|
|
63
|
+
+ import { } from "@clerk/nextjs"
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
</AccordionPanel>
|
|
67
|
+
<AccordionPanel>
|
|
68
|
+
```diff
|
|
69
|
+
- import { } from "@clerk/nextjs/edge-middleware"
|
|
70
|
+
+ import { } from "@clerk/nextjs"
|
|
71
|
+
```
|
|
72
|
+
</AccordionPanel>
|
|
73
|
+
<AccordionPanel>
|
|
74
|
+
```diff
|
|
75
|
+
- import { } from "@clerk/nextjs/edge-middlewarefiles"
|
|
76
|
+
+ import { } from "@clerk/nextjs"
|
|
77
|
+
```
|
|
78
|
+
</AccordionPanel>
|
|
79
|
+
<AccordionPanel>
|
|
80
|
+
The `@clerk/nextjs/api` subpath was removed completely. It re-exported helpers from `@clerk/clerk-sdk-node` and its types. If you relied on these, import from `@clerk/clerk-sdk-node` directly instead.
|
|
81
|
+
|
|
82
|
+
```diff
|
|
83
|
+
import type {
|
|
84
|
+
ClerkMiddleware,
|
|
85
|
+
ClerkMiddlewareOptions,
|
|
86
|
+
LooseAuthProp,
|
|
87
|
+
RequireAuthProp,
|
|
88
|
+
StrictAuthProp,
|
|
89
|
+
WithAuthProp
|
|
90
|
+
- } from "@clerk/nextjs/api"
|
|
91
|
+
+ } from "@clerk/clerk-sdk-node"
|
|
92
|
+
|
|
93
|
+
- import { requireAuth, withAuth } from "@clerk/nextjs/api"
|
|
94
|
+
+ import { requireAuth, withAuth } from "@clerk/clerk-sdk-node"
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
</AccordionPanel>
|
|
98
|
+
</Accordion>
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { readFileSync } from 'fs';
|
|
2
|
+
import { parseInline } from 'marked';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
const VERSION = 'v5';
|
|
7
|
+
async function generate() {
|
|
8
|
+
const data = (await import(`../../versions/${VERSION}/index.js`)).default['nextjs'];
|
|
9
|
+
let output = '';
|
|
10
|
+
output += `---
|
|
11
|
+
title: Upgrading Next.js from v4 to v5
|
|
12
|
+
description: Learn how to upgrade Clerk's Next.js SDK from v4 to v5.
|
|
13
|
+
---`;
|
|
14
|
+
output += '\n\n';
|
|
15
|
+
output += read('intro');
|
|
16
|
+
output += '\n';
|
|
17
|
+
output += read('version-requirements');
|
|
18
|
+
|
|
19
|
+
// This is a guide-specific item, no matcher for this
|
|
20
|
+
const defaultsChangeItem = {
|
|
21
|
+
title: 'Changes to default variables',
|
|
22
|
+
content: `\nThe default values of some [appearance variables](/docs/components/customization/variables) have changed which may impact your UI (if you are not already overriding them).
|
|
23
|
+
|
|
24
|
+
- The default \`colorPrimary\` value changed from \`#103FEF\` to \`#2F3037\`. As the new color is a dark grey, the \`colorPrimary\` of the dark theme was changed to \`#FFFFFF\`.
|
|
25
|
+
- The default \`fontSize\` value changed from \`1rem\` to \`0.8125rem\`
|
|
26
|
+
- The default \`fontWeight\` values changed from \`{ normal: 400, medium: 500, bold: 600 }\` to \`{ normal: 400, medium: 500, bold: 700 }\`
|
|
27
|
+
- Previously, the default value for \`fontSmoothing\` was \`auto\`. This value is now unset. If you want to pass a custom value to it, you can still do so.\n`
|
|
28
|
+
};
|
|
29
|
+
output += '\n';
|
|
30
|
+
output += read('retheme-changes');
|
|
31
|
+
const apperanceChanges = data.filter(i => i.category === 'appearance');
|
|
32
|
+
apperanceChanges.push(defaultsChangeItem);
|
|
33
|
+
const localizationChanges = data.filter(i => i.category === 'localization');
|
|
34
|
+
output += '\n';
|
|
35
|
+
output += '### Appearance changes';
|
|
36
|
+
output += '\n\n';
|
|
37
|
+
output += `<Accordion titles={[${apperanceChanges.map(i => `"${parseInline(i.title)}"`).join(', ')}]}>`;
|
|
38
|
+
output += '\n';
|
|
39
|
+
output += apperanceChanges.map(i => `<AccordionPanel>${i.content}</AccordionPanel>`).join('\n');
|
|
40
|
+
output += '</Accordion>';
|
|
41
|
+
output += '\n\n';
|
|
42
|
+
output += '### Localization changes';
|
|
43
|
+
output += '\n\n';
|
|
44
|
+
output += `<Accordion titles={[${localizationChanges.map(i => `"${parseInline(i.title)}"`).join(', ')}]}>`;
|
|
45
|
+
output += '\n';
|
|
46
|
+
output += localizationChanges.map(i => `<AccordionPanel>${i.content}</AccordionPanel>`).join('\n');
|
|
47
|
+
output += '</Accordion>';
|
|
48
|
+
output += '\n\n';
|
|
49
|
+
output += read('middleware-changes');
|
|
50
|
+
output += '\n\n';
|
|
51
|
+
output += read('import-changes');
|
|
52
|
+
output += '\n';
|
|
53
|
+
output += read('after-sign-x-handling');
|
|
54
|
+
output += '\n';
|
|
55
|
+
output += read('deprecation-removals');
|
|
56
|
+
const deprecationRemovals = data.filter(i => i.category === 'deprecation-removal');
|
|
57
|
+
const otherChanges = data.filter(i => !i.category);
|
|
58
|
+
output += '### Deprecation removals';
|
|
59
|
+
output += '\n\n';
|
|
60
|
+
output += `<Accordion titles={[${deprecationRemovals.map(i => `"${parseInline(i.title)}"`).join(', ')}]}>`;
|
|
61
|
+
output += '\n';
|
|
62
|
+
output += deprecationRemovals.map(i => `<AccordionPanel>${i.content}</AccordionPanel>`).join('\n');
|
|
63
|
+
output += '</Accordion>';
|
|
64
|
+
output += '\n\n';
|
|
65
|
+
output += '### Other breaking changes';
|
|
66
|
+
output += '\n\n';
|
|
67
|
+
output += `<Accordion titles={[${otherChanges.map(i => `"${parseInline(i.title)}"`).join(', ')}]}>`;
|
|
68
|
+
output += '\n';
|
|
69
|
+
output += otherChanges.map(i => `<AccordionPanel>${i.content}</AccordionPanel>`).join('\n');
|
|
70
|
+
output += '</Accordion>';
|
|
71
|
+
output += '\n\n';
|
|
72
|
+
|
|
73
|
+
// TODO: deal with HOF removals
|
|
74
|
+
|
|
75
|
+
return output;
|
|
76
|
+
}
|
|
77
|
+
generate().then(console.log);
|
|
78
|
+
function read(p) {
|
|
79
|
+
return readFileSync(path.join(__dirname, p + '.mdx'), 'utf8');
|
|
80
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Upgrading Next.js from v4 to v5
|
|
2
|
+
|
|
3
|
+
By the end of this guide, you’ll have successfully upgraded your Next.js project to use `@clerk/nextjs` v5. You’ll learn how to update your dependencies, resolve breaking changes, and find deprecations.
|
|
4
|
+
|
|
5
|
+
Step-by-step instructions will lead you through the process. If you’re looking for a reference list of changes, check out the general [upgrading from v4 to v5 guide](/docs/upgrade-guides/upgrading-from-v4-to-v5).
|
|
6
|
+
|
|
7
|
+
To aid you in this upgrade, Clerk built a CLI called [`@clerk/upgrade`](https://www.npmjs.com/package/@clerk/upgrade). Throughout this guide you'll see prompts to use the CLI which you can invoke directly in your terminal.
|
|
8
|
+
|
|
9
|
+
<CodeBlockTabs type="installer" options={["npm", "yarn", "pnpm"]}>
|
|
10
|
+
```bash filename="terminal"
|
|
11
|
+
npx @clerk/upgrade
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
```bash filename="terminal"
|
|
15
|
+
yarn dlx @clerk/upgrade
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
```bash filename="terminal"
|
|
19
|
+
pnpm dlx @clerk/upgrade
|
|
20
|
+
```
|
|
21
|
+
</CodeBlockTabs>
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
## New Middleware architecture
|
|
2
|
+
|
|
3
|
+
User and customer feedback about `authMiddleware()` has been clear in that Middleware logic was a often friction point. As such, in v5 you will find a completely new Middleware helper called [`clerkMiddleware()`](/docs/references/nextjs/clerk-middleware) that will hopefully alleviate all of the issues folks had with `authMiddleware()`.
|
|
4
|
+
|
|
5
|
+
Additionally, there are now new helpers that enable controlling auth on a _per-page and/or per-layout basis_ when using App Router. While you can still configure which routes are protected via Middleware, the page-based protection strategy is what is now recommended, as the co-location of auth protection configuration with the code for the pages themselves results in a superior developer experience that adds clarity as you navigate your codebase.
|
|
6
|
+
|
|
7
|
+
### Per-route auth config
|
|
8
|
+
|
|
9
|
+
Sometimes, code speaks louder than words. Let's get right into an example:
|
|
10
|
+
|
|
11
|
+
<Tabs type="auth-protect-layout-page" items={["Layout", "Page"]}>
|
|
12
|
+
<Tab>
|
|
13
|
+
```ts filename="app/src/dashboard/layout.tsx"
|
|
14
|
+
import { auth } from '@clerk/nextjs/server'
|
|
15
|
+
|
|
16
|
+
export default async function DashboardLayout({ children }) {
|
|
17
|
+
auth().protect();
|
|
18
|
+
// 👆 This one line is all it takes - the layout and all its children
|
|
19
|
+
// will now redirect to your sign in page for un-authenticated users.
|
|
20
|
+
|
|
21
|
+
return <>{children}</>
|
|
22
|
+
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
````
|
|
26
|
+
</Tab>
|
|
27
|
+
<Tab>
|
|
28
|
+
```ts filename="app/src/dashboard/page.tsx"
|
|
29
|
+
import { auth } from '@clerk/nextjs/server'
|
|
30
|
+
|
|
31
|
+
export default async function DashboardPage() {
|
|
32
|
+
auth().protect();
|
|
33
|
+
// 👆 This one line is all it takes - the layout and all its children
|
|
34
|
+
// will now redirect to your sign in page for un-authenticated users.
|
|
35
|
+
|
|
36
|
+
return <p>This page is now protected!</p>
|
|
37
|
+
}
|
|
38
|
+
````
|
|
39
|
+
|
|
40
|
+
</Tab>
|
|
41
|
+
</Tabs>
|
|
42
|
+
|
|
43
|
+
In this example, we add `auth().protect()` to a layout, and like magic, that layout and all of it's children will be gated by auth. The same logic can be applied for pages.
|
|
44
|
+
|
|
45
|
+
Want to get more specific with permission gating? Add the role you are gating as a param:
|
|
46
|
+
|
|
47
|
+
```ts filename="app/src/admin/layout.tsx"
|
|
48
|
+
import { auth } from '@clerk/nextjs/server';
|
|
49
|
+
|
|
50
|
+
export default async function AdminLayout({ children }) {
|
|
51
|
+
auth().protect({ role: 'org:admin' });
|
|
52
|
+
|
|
53
|
+
return <>{children}</>;
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Note that in order for this to work, you will still need Middleware to be present, but it only requires the most minimal configuration:
|
|
58
|
+
|
|
59
|
+
```ts filename="middleware.ts"
|
|
60
|
+
import { clerkMiddleware } from '@clerk/nextjs/server';
|
|
61
|
+
|
|
62
|
+
export default clerkMiddleware();
|
|
63
|
+
|
|
64
|
+
export const config = {
|
|
65
|
+
matcher: ['/((?!.*\\..*|_next).*)', '/', '/(api|trpc)(.*)'],
|
|
66
|
+
};
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
If you are using the pages router, per-route gating won't work. Instead, configure your auth gating via Middleware as described in the next section.
|
|
70
|
+
|
|
71
|
+
### Middleware auth config
|
|
72
|
+
|
|
73
|
+
If you prefer to define your auth logic within the Middleware, you can still do this using the new `clerkMiddleware`. The primary change from the previous `authMiddleware()` is that `clerkMiddleware()` does not protect any routes by default, instead requiring the developer to add routes they would like to be protected by auth. This is a substantial contrast to the previous `authMiddleware()`, which protected all routes by default, requiring the developer to add exceptions. The API was also substantially simplified, and it has become easier to combine with other Middleware helpers smoothly as well.
|
|
74
|
+
|
|
75
|
+
Here's an example that replicates the auth protection scheme above, but entirely inside the Middleware:
|
|
76
|
+
|
|
77
|
+
```ts filename="middleware.ts"
|
|
78
|
+
import { clerkMiddleware, createRouteMatcher } from '@clerk/nextjs/server';
|
|
79
|
+
|
|
80
|
+
const isDashboardRoute = createRouteMatcher(['/dashboard(.*)']);
|
|
81
|
+
const isAdminRoute = createRouteMatcher(['/admin']);
|
|
82
|
+
|
|
83
|
+
export default clerkMiddleware((auth, req) => {
|
|
84
|
+
// Restrict admin route to users with specific role
|
|
85
|
+
if (isAdminRoute(req)) auth().protect({ role: 'org:admin' });
|
|
86
|
+
|
|
87
|
+
// Restrict dashboard routes to logged in users
|
|
88
|
+
if (isDashboardRoute(req)) auth().protect();
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
export const config = {
|
|
92
|
+
matcher: ['/((?!.*\\..*|_next).*)', '/', '/(api|trpc)(.*)'],
|
|
93
|
+
};
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
A couple things to note here:
|
|
97
|
+
|
|
98
|
+
- The `createRouteMatcher` helper makes it easy to define route groups that you can leverage inside the Middleware function and check in whichever order you'd like. Note that it can take an array of routes as well.
|
|
99
|
+
- With `clerkMiddleware`, you're defining the routes you want **to be protected**, rather than the routes you don't want to be protected.
|
|
100
|
+
- You are able to use the same `auth().protect()` helpers that you can use within layouts/pages here in the Middleware.
|
|
101
|
+
|
|
102
|
+
### Migrating to `clerkMiddleware()`
|
|
103
|
+
|
|
104
|
+
Clerk strongly recommends migrating to the new `clerkMiddleware()` for an improved DX and access to all present and upcoming features, but also want to note that `authMiddleware()`, while deprecated, will continue to work in v5 and will not be removed until the next major version, so you do not _need_ to make any changes to your Middleware setup this version.
|
|
105
|
+
|
|
106
|
+
The most basic migration will be updating the import and changing out the default export.
|
|
107
|
+
|
|
108
|
+
```diff
|
|
109
|
+
- import { authMiddleware } from "@clerk/nextjs"
|
|
110
|
+
+ import { clerkMiddleware } from '@clerk/nextjs/server'
|
|
111
|
+
|
|
112
|
+
- export default authMiddleware()
|
|
113
|
+
+ export default clerkMiddleware()
|
|
114
|
+
|
|
115
|
+
export const config = {
|
|
116
|
+
matcher: ["/((?!.*\\..*|_next).*)", "/", "/(api|trpc)(.*)"],
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Of course, in most cases you'll have a more complicated setup than this. You can find some examples below for how to migrate a few common use cases. Be sure to review the [`clerkMiddleware()` documentation](/docs/references/nextjs/clerk-middleware) and [route protection guide](/docs/references/nextjs/route-protection) if your specific use case is not mentioned.
|
|
121
|
+
|
|
122
|
+
<Accordion titles={["Making the index page public", "Protecting a single route path", "Combining with other Middlewares (like i18n)"]} heading="h4">
|
|
123
|
+
<AccordionPanel>
|
|
124
|
+
By default, `clerkMiddleware()` treats all pages as public, so you no longer need to explcitly set `/` as public.
|
|
125
|
+
|
|
126
|
+
Before:
|
|
127
|
+
|
|
128
|
+
```ts filename="middleware.ts"
|
|
129
|
+
import { authMiddleware } from "@clerk/nextjs"
|
|
130
|
+
|
|
131
|
+
export default authMiddleware({
|
|
132
|
+
publicRoutes: ["/"],
|
|
133
|
+
})
|
|
134
|
+
|
|
135
|
+
export const config = {
|
|
136
|
+
matcher: ["/((?!.+\\.[\\w]+$|_next).*)", "/", "/(api|trpc)(.*)"],
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
After:
|
|
141
|
+
|
|
142
|
+
```ts filename="middleware.ts"
|
|
143
|
+
import {
|
|
144
|
+
clerkMiddleware,
|
|
145
|
+
createRouteMatcher
|
|
146
|
+
} from "@clerk/nextjs/server"
|
|
147
|
+
|
|
148
|
+
export default clerkMiddleware()
|
|
149
|
+
|
|
150
|
+
export const config = {
|
|
151
|
+
matcher: ["/((?!.+\\.[\\w]+$|_next).*)", "/", "/(api|trpc)(.*)"],
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
</AccordionPanel>
|
|
156
|
+
<AccordionPanel>
|
|
157
|
+
Having all routes public except everything under `/dashboard`.
|
|
158
|
+
|
|
159
|
+
Before:
|
|
160
|
+
|
|
161
|
+
```ts filename="middleware.ts"
|
|
162
|
+
import { authMiddleware } from "@clerk/nextjs"
|
|
163
|
+
|
|
164
|
+
export default authMiddleware({
|
|
165
|
+
publicRoutes: (req) => !req.url.includes("/dashboard"),
|
|
166
|
+
})
|
|
167
|
+
|
|
168
|
+
export const config = {
|
|
169
|
+
matcher: ["/((?!.+\\.[\\w]+$|_next).*)", "/", "/(api|trpc)(.*)"],
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
After:
|
|
174
|
+
|
|
175
|
+
```ts filename="middleware.ts"
|
|
176
|
+
import {
|
|
177
|
+
clerkMiddleware,
|
|
178
|
+
createRouteMatcher
|
|
179
|
+
} from "@clerk/nextjs/server"
|
|
180
|
+
|
|
181
|
+
const isDashboardRoute = createRouteMatcher(["/dashboard(.*)"])
|
|
182
|
+
|
|
183
|
+
export default clerkMiddleware((auth, request) => {
|
|
184
|
+
if (isDashboardRoute(request)) {
|
|
185
|
+
auth().protect()
|
|
186
|
+
}
|
|
187
|
+
})
|
|
188
|
+
|
|
189
|
+
export const config = {
|
|
190
|
+
matcher: ["/((?!.+\\.[\\w]+$|_next).*)", "/", "/(api|trpc)(.*)"],
|
|
191
|
+
}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
</AccordionPanel>
|
|
195
|
+
<AccordionPanel>
|
|
196
|
+
You can call other Middlewares inside `clerkMiddleware()`, giving you more direct control over what is called where. An example would be [next-intl](https://next-intl-docs.vercel.app/) to add internationalization to your app.
|
|
197
|
+
|
|
198
|
+
Before:
|
|
199
|
+
|
|
200
|
+
```ts filename="middleware.ts"
|
|
201
|
+
import { authMiddleware } from "@clerk/nextjs"
|
|
202
|
+
import createMiddleware from "next-intl/middleware"
|
|
203
|
+
|
|
204
|
+
const intlMiddleware = createMiddleware({
|
|
205
|
+
locales: ["en", "de"],
|
|
206
|
+
defaultLocale: "en",
|
|
207
|
+
})
|
|
208
|
+
|
|
209
|
+
export default authMiddleware({
|
|
210
|
+
beforeAuth: (req) => {
|
|
211
|
+
return intlMiddleware(req);
|
|
212
|
+
},
|
|
213
|
+
publicRoutes: ["((?!^/dashboard/).*)"],
|
|
214
|
+
})
|
|
215
|
+
|
|
216
|
+
export const config = {
|
|
217
|
+
matcher: ["/((?!.+\\.[\\w]+$|_next).*)", "/", "/(api|trpc)(.*)"],
|
|
218
|
+
}
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
After:
|
|
222
|
+
|
|
223
|
+
```ts filename="middleware.ts"
|
|
224
|
+
import {
|
|
225
|
+
clerkMiddleware,
|
|
226
|
+
createRouteMatcher
|
|
227
|
+
} from "@clerk/nextjs/server"
|
|
228
|
+
import createMiddleware from "next-intl/middleware"
|
|
229
|
+
|
|
230
|
+
const intlMiddleware = createMiddleware({
|
|
231
|
+
locales: ["en", "de"],
|
|
232
|
+
defaultLocale: "en",
|
|
233
|
+
})
|
|
234
|
+
|
|
235
|
+
const isDashboardRoute = createRouteMatcher(["/dashboard(.*)"])
|
|
236
|
+
|
|
237
|
+
export default clerkMiddleware((auth, request) => {
|
|
238
|
+
if (isDashboardRoute(request)) {
|
|
239
|
+
auth().protect()
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
return intlMiddleware(request)
|
|
243
|
+
})
|
|
244
|
+
|
|
245
|
+
export const config = {
|
|
246
|
+
matcher: ["/((?!.+\\.[\\w]+$|_next).*)", "/", "/(api|trpc)(.*)"],
|
|
247
|
+
}
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
</AccordionPanel>
|
|
251
|
+
</Accordion>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
## Redesigned components
|
|
2
|
+
|
|
3
|
+
The new version ships with improved design and UX across all of Clerk's [UI components](/docs/components/overview). If you have used the [`appearance` prop](/docs/components/customization/overview) or tokens for a [custom theme](/docs/components/customization/overview#create-a-custom-theme), you will likely need to make some adjustments to ensure your styling is still looking great. If you're using the [localization prop](/docs/components/customization/localization) you will likely need to make adjustments to account for added or removed localization keys.
|
|
4
|
+
|
|
5
|
+
<Callout type='info'>
|
|
6
|
+
If you are not customizing the appearance of your components, or using `localization`, you can skip this section. Otherwise, it's recommended to use our CLI (`npx @clerk/upgrade`) to scan for changes required as part of the component
|
|
7
|
+
redesign more quickly.
|
|
8
|
+
</Callout>
|
|
9
|
+
|
|
10
|
+
The sections below contain more info on each change made to the customization ids and localization keys for reference. Regardless of how thoroughly you have reviewed the following information, you should still take some time to manually look through each of your views to ensure that everything looks good.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
## Minimum version requirements
|
|
2
|
+
|
|
3
|
+
We have updated some of our minumum version requirements for Node.js, React, and Next.js such that versions that are no longer supported or are at end-of-life are no longer guaranteed to work correctly with Clerk. Please take a moment to check your dependencies and ensure you are up to date!
|
|
4
|
+
|
|
5
|
+
**Updating Node.js**
|
|
6
|
+
|
|
7
|
+
You need to have Node.js `18.17.0` or later installed. Last year, Node.js 16 entered EOL (End of life) status so it's time to bump the required version for `@clerk/nextjs`, too. You can check your Node.js version by running `node -v` in your terminal. Learn more about how to [update and install Node.js](https://nodejs.org/en/learn/getting-started/how-to-install-nodejs).
|
|
8
|
+
|
|
9
|
+
**Updating React**
|
|
10
|
+
|
|
11
|
+
`@clerk/nextjs` now requires you to use React 18 or higher. You can update your project by installing the latest version of `react` and `react-dom`.
|
|
12
|
+
|
|
13
|
+
<CodeBlockTabs type="installer" options={["npm", "yarn", "pnpm"]}>
|
|
14
|
+
```bash filename="terminal"
|
|
15
|
+
npm install react@latest react-dom@latest
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
```bash filename="terminal"
|
|
19
|
+
yarn add react@latest react-dom@latest
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
```bash filename="terminal"
|
|
23
|
+
pnpm add react@latest react-dom@latest
|
|
24
|
+
```
|
|
25
|
+
</CodeBlockTabs>
|
|
26
|
+
|
|
27
|
+
If you are upgrading from React 17 or lower, make sure to [learn about how to upgrade your React version to 18](https://react.dev/blog/2022/03/08/react-18-upgrade-guide) as well.
|
|
28
|
+
|
|
29
|
+
**Updating Next.js**
|
|
30
|
+
|
|
31
|
+
`@clerk/nextjs` now requires you to use Next.js version `13.0.4` or later. Check out Next's upgrade guides for more guidance if you have not yet upgraded to Next.js 13:
|
|
32
|
+
|
|
33
|
+
- [Upgrading from 12 to 13](https://nextjs.org/docs/pages/building-your-application/upgrading/version-13)
|
|
34
|
+
- [Upgrading from 13 to 14](https://nextjs.org/docs/app/building-your-application/upgrading/version-14)
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
### Clerk client setters removed in favor of `createClerkClient` options
|
|
2
|
+
|
|
3
|
+
The following setter methods have been removed in the lastest version. If you were using any of these functions, their functionality can be replaced by instead passing the correponding option to `createClerkClient`.
|
|
4
|
+
|
|
5
|
+
- `setClerkApiVersion`
|
|
6
|
+
- `setClerkHttpOptions`
|
|
7
|
+
- `setClerkServerApiUrl`
|
|
8
|
+
- `setClerkApiKey`
|
|
9
|
+
|
|
10
|
+
Code example:
|
|
11
|
+
|
|
12
|
+
```diff
|
|
13
|
+
import {
|
|
14
|
+
clerkClient,
|
|
15
|
+
- setClerkApiKey,
|
|
16
|
+
- setClerkApiVersion,
|
|
17
|
+
- setClerkHttpOptions,
|
|
18
|
+
- setClerkServerApiUrl
|
|
19
|
+
} from "@clerk/clerk-sdk-node"
|
|
20
|
+
|
|
21
|
+
- setClerkApiKey("...")
|
|
22
|
+
- setClerkApiVersion("...")
|
|
23
|
+
- setClerkHttpOptions("...")
|
|
24
|
+
- setClerkServerApiUrl("...")
|
|
25
|
+
|
|
26
|
+
const clerkClient = createClerkClient({
|
|
27
|
+
+ secretKey: "..."
|
|
28
|
+
+ apiVersion: "..."
|
|
29
|
+
+ httpOptions: "..."
|
|
30
|
+
+ serverApiUrl: "..."
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
await clerkClient.users.getUser(userId);
|
|
34
|
+
```
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#### Changes to some function return signatures
|
|
2
|
+
|
|
3
|
+
There have been changes to return signatures for some functions. Since Clerk's API responses are paginated, the `totalCount` property is helpful in determining the total number of items in the response easily. This change also aligns the response shape with what is returned from the Clerk backend API. Each impacted function is listed below, along with code examples:
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
### Path routing is now the default
|
|
2
|
+
|
|
3
|
+
On components like [`<SignIn />`](/docs/components/authentication/sign-in) you can define the props `routing` and `path`. `routing` can be set to `'hash' | 'path' | 'virtual'` and describes the routing strategy that should be used. `path` defines where the component is mounted when `routing="path"` is used.
|
|
4
|
+
|
|
5
|
+
In the latest version, the **default** `routing` strategy has become `'path'`. Unless you change the `routing` prop, you'll need to define the `path` prop. The affected components are:
|
|
6
|
+
|
|
7
|
+
- `<SignIn />`
|
|
8
|
+
- `<SignUp />`
|
|
9
|
+
- `<UserProfile />`
|
|
10
|
+
- `<CreateOrganization />`
|
|
11
|
+
- `<OrganizationProfile />`
|
|
12
|
+
|
|
13
|
+
Here's how you'd use the components going forward:
|
|
14
|
+
|
|
15
|
+
```jsx
|
|
16
|
+
<SignIn path="/sign-in" />
|
|
17
|
+
<SignUp path="/sign-up" />
|
|
18
|
+
<UserProfile path="/user-profile" />
|
|
19
|
+
<CreateOrganization path="/create-org" />
|
|
20
|
+
<OrganizationProfile path="/org-profile" />
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
If you don't define the `path` prop an error will be thrown. Of course, you can still use `routing="hash"` or `routing="virtual"`.
|
|
24
|
+
|
|
25
|
+
```jsx
|
|
26
|
+
<UserProfile routing="hash" />
|
|
27
|
+
<OrganizationProfile routing="virtual" />
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
However, there are two exceptions to this behavior. If you're using `@clerk/nextjs` or `@clerk/remix`, you can set environment variables for `<SignIn />` and `<SignUp />`.
|
|
31
|
+
|
|
32
|
+
<CodeBlockTabs options={["Next.js", "Remix"]}>
|
|
33
|
+
```env filename=".env.local"
|
|
34
|
+
NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in
|
|
35
|
+
NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
```env filename=".env"
|
|
39
|
+
CLERK_SIGN_IN_URL=/sign-in
|
|
40
|
+
CLERK_SIGN_UP_URL=/sign-up
|
|
41
|
+
```
|
|
42
|
+
</CodeBlockTabs>
|
|
43
|
+
|
|
44
|
+
**Only** if you're using one of these two frameworks and defined both environment variables, you're able to use the `<SignIn />` and `<SignUp />` components without any props.
|
|
45
|
+
|
|
46
|
+
```jsx
|
|
47
|
+
// Only works for Next.js / Remix when environment variables are set
|
|
48
|
+
<SignIn />
|
|
49
|
+
<SignUp />
|
|
50
|
+
```
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
## SDK Guides
|
|
2
|
+
|
|
3
|
+
Select the SDK(s) you are using for your project from the list below to read through a summary of all the breaking changes:
|
|
4
|
+
|
|
5
|
+
> Note: I want a prettier selection component here, in it's absence for now there's a list
|
|
6
|
+
|
|
7
|
+
- [Next.js](upgrading-nextjs-from-v4-to-v5)
|
|
8
|
+
- [Remix](#remix)
|
|
9
|
+
- [Expo](#expo)
|
|
10
|
+
- [Gatsby](#gatsby)
|
|
11
|
+
- [Backend](#backend)
|
|
12
|
+
- [Node](#node)
|
|
13
|
+
- [Fastify](#fastify)
|
|
14
|
+
- [React](#react)
|
|
15
|
+
- [JS](#js)
|
|
16
|
+
- [Chrome Extension](#chrome-extension)
|