diff --git a/.changeset/late-dolphins-peel.md b/.changeset/late-dolphins-peel.md new file mode 100644 index 00000000000..04e3344490e --- /dev/null +++ b/.changeset/late-dolphins-peel.md @@ -0,0 +1,5 @@ +--- +"@clerk/backend": minor +--- + +Add support for NextJS 14 diff --git a/.changeset/tasty-countries-walk.md b/.changeset/tasty-countries-walk.md new file mode 100644 index 00000000000..f6ceef5af0a --- /dev/null +++ b/.changeset/tasty-countries-walk.md @@ -0,0 +1,5 @@ +--- +'@clerk/clerk-sdk-node': patch +--- + +Fix types of ClerkExpressWithAuth/ClerkExpressRequireAuth args diff --git a/packages/backend/src/runtime/browser/fetch.mjs b/packages/backend/src/runtime/browser/fetch.mjs index 86ef402b1ce..3c3e70ae40f 100644 --- a/packages/backend/src/runtime/browser/fetch.mjs +++ b/packages/backend/src/runtime/browser/fetch.mjs @@ -5,3 +5,4 @@ export const RuntimeHeaders = Headers; export const RuntimeRequest = Request; export const RuntimeResponse = Response; export const RuntimeAbortController = AbortController; +export const RuntimeFetch = fetch; diff --git a/packages/backend/src/runtime/index.ts b/packages/backend/src/runtime/index.ts index f77338cb6d5..89a1d7c1a77 100644 --- a/packages/backend/src/runtime/index.ts +++ b/packages/backend/src/runtime/index.ts @@ -18,7 +18,7 @@ import crypto from '#crypto'; import * as fetchApisPolyfill from '#fetch'; const { - default: fetch, + RuntimeFetch, RuntimeAbortController, RuntimeBlob, RuntimeFormData, @@ -44,7 +44,7 @@ type Runtime = { // The globalThis object is supported for Node >= 12.0. // // https://github.com/supabase/supabase/issues/4417 -const globalFetch = fetch.bind(globalThis); +const globalFetch = RuntimeFetch.bind(globalThis); // DO NOT CHANGE: Runtime needs to be imported as a default export so that we can stub its dependencies with Sinon.js // For more information refer to https://sinonjs.org/how-to/stub-dependency/ const runtime: Runtime = { diff --git a/packages/backend/src/runtime/node/fetch.js b/packages/backend/src/runtime/node/fetch.js index 58b33cabadc..38f0e8de6ea 100644 --- a/packages/backend/src/runtime/node/fetch.js +++ b/packages/backend/src/runtime/node/fetch.js @@ -8,3 +8,4 @@ module.exports.RuntimeHeaders = Headers; module.exports.RuntimeRequest = Request; module.exports.RuntimeResponse = Response; module.exports.RuntimeAbortController = AbortController; +module.exports.RuntimeFetch = fetch; diff --git a/packages/sdk-node/src/clerkClient.ts b/packages/sdk-node/src/clerkClient.ts index 6f9cc6a35b8..b562f450791 100644 --- a/packages/sdk-node/src/clerkClient.ts +++ b/packages/sdk-node/src/clerkClient.ts @@ -75,13 +75,13 @@ export const clerkClient = new Proxy(clerkClientSingleton, { /** * Stand-alone express middlewares bound to the pre-initialised clerkClient */ -export const ClerkExpressRequireAuth = (...args: any) => { +export const ClerkExpressRequireAuth = (...args: Parameters>) => { const env = { ...loadApiEnv(), ...loadClientEnv() }; const fn = createClerkExpressRequireAuth({ clerkClient, ...env }); return fn(...args); }; -export const ClerkExpressWithAuth = (...args: any) => { +export const ClerkExpressWithAuth = (...args: Parameters>) => { const env = { ...loadApiEnv(), ...loadClientEnv() }; const fn = createClerkExpressWithAuth({ clerkClient, ...env }); return fn(...args);