fix: resolve __dirname error by forcing Node.js runtime on all server routes

- Add serverExternalPackages for @supabase/ssr in next.config.ts
- Add export const runtime = 'nodejs' to all pages/routes using Supabase
- Replace createAdminClient to use @supabase/supabase-js directly (no SSR)
- Prevents @supabase/ssr from running in Edge runtime on Vercel

https://claude.ai/code/session_01H2aRGDaKgarPvhay2HxN6Y
This commit is contained in:
Claude
2026-02-08 19:08:32 +00:00
parent d713f7f5ef
commit ee6870d73e
9 changed files with 19 additions and 11 deletions

View File

@@ -2,6 +2,8 @@ import { NextResponse } from "next/server";
import { createAdminClient } from "@/lib/supabase/server";
import type { CandidatureInsert } from "@/types/database.types";
export const runtime = "nodejs";
export async function POST(request: Request) {
try {
const body = await request.json();

View File

@@ -2,6 +2,8 @@ import { NextResponse } from "next/server";
import { createClient } from "@/lib/supabase/server";
import type { Module, UserProgress } from "@/types/database.types";
export const runtime = "nodejs";
// GET /api/formations/[moduleId] - Récupérer un module
export async function GET(
_request: Request,

View File

@@ -2,6 +2,8 @@ import { NextResponse } from "next/server";
import { stripe } from "@/lib/stripe/client";
import { getBaseUrl } from "@/lib/utils";
export const runtime = "nodejs";
export async function POST(request: Request) {
try {
const body = await request.json();