pitcheye.dev← All 30 rules
severity: errorpack: supabase-authv1.0 core

supabase-auth/sync-cookies-next15

`cookies()` used synchronously on Next 15

npx @pitcheye/check . --pack supabase-auth

whyItBreaks

`cookies()`, `headers()` and `draftMode()` became async in Next 15. The sync form returns a Promise, so `cookieStore.getAll()` is undefined, the Supabase client builds with zero cookies, and every request is anonymous — including the ones that just signed in.

✖ Bad — triggers errorfixtures/supabase-auth-sync-cookies-next15/bad
const cookieStore = cookies();
✓ Good — passes checkfixtures/supabase-auth-sync-cookies-next15/good
const cookieStore = await cookies();

suggestedFix

Make the function async and await it: `const cookieStore = await cookies()`.

explain_rule({"supabase-auth/sync-cookies-next15"})

Agent & MCP JSON output contract

{
  "ruleId": "supabase-auth/sync-cookies-next15",
  "pack": "supabase-auth",
  "severity": "error",
  "file": "apps/web/src/app/dashboard/page.tsx",
  "line": 6,
  "message": "`const cookieStore = cookies()` with no `await`, in a module importing `next/headers`",
  "whyItBreaks": "`cookies()`, `headers()` and `draftMode()` became async in Next 15. The sync form returns a Promise, so `cookieStore.getAll()` is undefined, the Supabase client builds with zero cookies, and every request is anonymous — including the ones that just signed in.",
  "suggestedFix": "Make the function async and await it: `const cookieStore = await cookies()`.",
  "docsUrl": "https://pitcheye.dev/rules/supabase-auth-sync-cookies-next15"
}

Markdown: curl -H "Accept: text/markdown" https://pitcheye.dev/rules/supabase-auth-sync-cookies-next15

raw markdown
# supabase-auth/sync-cookies-next15

- **severity:** error
- **pack:** supabase-auth
- **docs:** https://pitcheye.dev/rules/supabase-auth-sync-cookies-next15

## whyItBreaks

`cookies()`, `headers()` and `draftMode()` became async in Next 15. The sync form returns a Promise, so `cookieStore.getAll()` is undefined, the Supabase client builds with zero cookies, and every request is anonymous — including the ones that just signed in.

## bad

```ts
const cookieStore = cookies();
```

## good

```ts
const cookieStore = await cookies();
```

## suggestedFix

Make the function async and await it: `const cookieStore = await cookies()`.

## commands

```bash
npx @pitcheye/check . --pack supabase-auth
```

```json
{"tool":"explain_rule","arguments":{"ruleId":"supabase-auth/sync-cookies-next15"}}
```
← supabase-auth/missing-session-refresh-middlewareBack to rule catalog