@delmaredigital/payload-better-auth 0.6.1 → 0.6.2
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/plugin/index.js
CHANGED
|
@@ -481,6 +481,12 @@ let apiKeyPermissionsConfig = undefined;
|
|
|
481
481
|
console.error('[better-auth] Failed to create auth:', error);
|
|
482
482
|
throw error;
|
|
483
483
|
}
|
|
484
|
+
// Warn if nextCookies() plugin is detected — it's incompatible with Payload CMS.
|
|
485
|
+
// Check via betterAuthOptions (if provided) or the auth instance's options.
|
|
486
|
+
const pluginsToCheck = options.admin?.betterAuthOptions?.plugins ?? authInstance.options?.plugins;
|
|
487
|
+
if (pluginsToCheck?.some((p)=>p.id === 'next-cookies')) {
|
|
488
|
+
console.warn('\n⚠️ [payload-better-auth] The nextCookies() plugin was detected in your Better Auth config.\n' + ' This plugin is INCOMPATIBLE with Payload CMS and will cause infinite form-state\n' + ' submissions and input resets in the admin panel.\n\n' + ' The nextCookies() plugin is designed for Server Actions, but payload-better-auth\n' + ' handles cookie passthrough automatically via its endpoint proxy.\n\n' + ' → Remove nextCookies() from your Better Auth plugins to fix this issue.\n' + ' → See: https://github.com/delmaredigital/payload-better-auth/issues/15\n');
|
|
489
|
+
}
|
|
484
490
|
}
|
|
485
491
|
// Attach to payload for global access
|
|
486
492
|
Object.defineProperty(payload, 'betterAuth', {
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
hasPasskey: false,
|
|
16
16
|
hasMagicLink: false,
|
|
17
17
|
hasMultiSession: false,
|
|
18
|
-
hasOrganization: false
|
|
18
|
+
hasOrganization: false,
|
|
19
|
+
hasNextCookies: false
|
|
19
20
|
};
|
|
20
21
|
for (const plugin of plugins){
|
|
21
22
|
// Better Auth plugins have an id property
|
|
@@ -42,6 +43,9 @@
|
|
|
42
43
|
case 'organization':
|
|
43
44
|
result.hasOrganization = true;
|
|
44
45
|
break;
|
|
46
|
+
case 'next-cookies':
|
|
47
|
+
result.hasNextCookies = true;
|
|
48
|
+
break;
|
|
45
49
|
}
|
|
46
50
|
}
|
|
47
51
|
return result;
|