fix: load db after env for direct upload cors
Some checks failed
Lint / build (20) (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled

This commit is contained in:
Your Name 2026-05-27 11:07:55 +08:00
parent c24ccebb18
commit 9328efa701

View File

@ -8,9 +8,6 @@ import {
} from "@aws-sdk/client-s3";
import { and, eq } from "drizzle-orm";
import { db } from "@/lib/db";
import { storageConfig } from "@/lib/db/schema";
loadEnv({ path: ".env.local" });
loadEnv();
@ -113,6 +110,10 @@ function readEnvS3Config(): S3UploadConfig | null {
}
async function resolveS3Config() {
const [{ db }, { storageConfig }] = await Promise.all([
import("@/lib/db"),
import("@/lib/db/schema"),
]);
const [defaultConfig] = await db
.select()
.from(storageConfig)