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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Types and NextJS 14 support (#1939, #1948) #1968

Merged
merged 2 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/late-dolphins-peel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@clerk/backend": minor
---

Add support for NextJS 14
5 changes: 5 additions & 0 deletions .changeset/tasty-countries-walk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@clerk/clerk-sdk-node': patch
---

Fix types of ClerkExpressWithAuth/ClerkExpressRequireAuth args
1 change: 1 addition & 0 deletions packages/backend/src/runtime/browser/fetch.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ export const RuntimeHeaders = Headers;
export const RuntimeRequest = Request;
export const RuntimeResponse = Response;
export const RuntimeAbortController = AbortController;
export const RuntimeFetch = fetch;
4 changes: 2 additions & 2 deletions packages/backend/src/runtime/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import crypto from '#crypto';
import * as fetchApisPolyfill from '#fetch';

const {
default: fetch,
RuntimeFetch,
RuntimeAbortController,
RuntimeBlob,
RuntimeFormData,
Expand All @@ -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 = {
Expand Down
1 change: 1 addition & 0 deletions packages/backend/src/runtime/node/fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ module.exports.RuntimeHeaders = Headers;
module.exports.RuntimeRequest = Request;
module.exports.RuntimeResponse = Response;
module.exports.RuntimeAbortController = AbortController;
module.exports.RuntimeFetch = fetch;
4 changes: 2 additions & 2 deletions packages/sdk-node/src/clerkClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<ReturnType<typeof createClerkExpressRequireAuth>>) => {
const env = { ...loadApiEnv(), ...loadClientEnv() };
const fn = createClerkExpressRequireAuth({ clerkClient, ...env });
return fn(...args);
};

export const ClerkExpressWithAuth = (...args: any) => {
export const ClerkExpressWithAuth = (...args: Parameters<ReturnType<typeof createClerkExpressWithAuth>>) => {
const env = { ...loadApiEnv(), ...loadClientEnv() };
const fn = createClerkExpressWithAuth({ clerkClient, ...env });
return fn(...args);
Expand Down