fix(storage): make next/headers import lazy in api.js to avoid module resolution failure
- replace top-level `import { cookies } from 'next/headers'` with lazy `await import('next/headers')` inside handler
- document the constraint in PROJECT.md: no top-level next/headers or next/navigation imports reachable from module register() chains
This commit is contained in:
@@ -15,7 +15,6 @@
|
||||
* registerFeatureRoutes in core/api/runtime.js.
|
||||
*/
|
||||
|
||||
import { cookies } from 'next/headers';
|
||||
import { getSessionCookieName } from '@zen/core/shared/config';
|
||||
import { getSessionResolver } from '../api/router.js';
|
||||
import { getFile } from './index.js';
|
||||
@@ -60,6 +59,7 @@ async function handleGetFile(_request, { wildcard: fileKey }) {
|
||||
}
|
||||
|
||||
// Require authentication for all other paths.
|
||||
const { cookies } = await import('next/headers');
|
||||
const cookieStore = await cookies();
|
||||
const sessionToken = cookieStore.get(COOKIE_NAME)?.value;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user