const session = cookies().get('session')核心優勢
升級 Next.js 16 並調整登入頁
DraftDescription
將專案升級至 Next.js 16,並更新登入頁的 session 讀取流程。
- 更新
next依賴版本 - 調整
app/account/page.tsx
Activity
History · 5 events- @developer opened this merge request · 3 小時前
- AI Review Bot started a thread on the diff · 2 小時前AI Review Bot @ai-review started a thread on the diff✓ Resolvedapp/account/page.tsx27+
- AI Review Bot started a thread on the diff · 2 小時前AI Review Bot @ai-review started a thread on the diffOpenpackage.json12+
"next": "^16.0.0"🟠 MUST · Bug: Next.js 16 已移除 next lint
升級了
next,但 repo 的 lint script 仍是next lint;CI 執行 lint 時會失敗。如何修正:把 lint script 改成
eslint .,並確認 ESLint 設定可用。📖 依據:已讀
package.json的依賴與 script;透過 Context7 核對 Next.js 16 官方升級文件,確認next lint已移除。 - AI Review Bot commented · review summary
AI Code Review —
8f3a21c4本 MR 升級 Next.js 16,並調整登入頁。
Overall Risk: 🟠 HighSpec CheckContext7 核對 Next.js 16 官方文件:
cookies()與next lint的用法需要更新。Key Findings登入頁仍同步讀取 cookie;CI lint script 仍呼叫已移除的指令。
Recommended Tests登入後重整頁面,並執行
npm run lint。 - @developer replied to the cookie thread · 1 小時前
作者回覆 · 已修正
改用await cookies(),並補上登入測試。
2 commits
commit 1升級 Next.js 16內容示意commit 2調整登入頁內容示意Codex 會讀取本輪變更與先前 review 討論,避免重複留言。
Pipeline #128
Merge Request pipeline · Waiting for manual action
Changes · 2 files
"lint": "next lint""next": "^15.5.0""next": "^16.0.0"export default async function AccountPage() {const session = cookies().get('session')const cookieStore = await cookies()const session = cookieStore.get('session')用 ChatGPT 方案執行
Codex OAuth 不需 OpenAI API key。Manual job 控制執行時機;用量仍依 ChatGPT 方案或工作空間額度。
預設 gpt-6-luna · max Fast mode 預設開啟;設 AI_REVIEW_FAST=0 可改用一般模式。
無縫整合到專案 Repository
在現有 .gitlab-ci.yml 加入 include,並將 review 放進 stages。
include:
- project: 'mpqa-team/research/ai-code-review'
ref: latest
file: 'templates/ai-review.yml'
stages:
- review- CODEX_AUTH_JSON
- 自己的 Codex OAuth 登入資料,設成 Masked、Protected CI/CD variable;請主動定期更新。
- GITLAB_TOKEN
- 自己的 GitLab project access token,需有
apiscope,供 job 回寫 MR。 - CONTEXT7_API_KEY(選用)
- 啟用 Context7,讓 reviewer 核對第三方 library 的現行官方文件。
- 模型
- 預設
gpt-6-luna、effortmax;可用CODEX_MODEL覆蓋模型。
如何準備 OAuth 與定期更新?
先用 ChatGPT 帳號登入 Codex,再將 ~/.codex/auth.json 編碼後存為 CODEX_AUTH_JSON:
base64 < ~/.codex/auth.json | tr -d '\n'請主動定期用最新的 auth.json 更新 CODEX_AUTH_JSON。Base64 不是加密。
🟠 MUST · Bug: Next.js 16 要先 await cookies()
repo 已升級到 Next.js 16,這行仍同步讀取 cookie,登入頁可能無法取得 session。
如何修正:先用
const cookieStore = await cookies(),再呼叫cookieStore.get('session')。📖 依據:已讀
package.json與登入頁;透過 Context7 核對 Next.js 16 官方升級文件,同步存取已移除。