Skip to content

Commit b54b4bb

Browse files
committed
please
1 parent ec76c0f commit b54b4bb

4 files changed

Lines changed: 10 additions & 15 deletions

File tree

cloudflare-env.d.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
/* eslint-disable */
2-
// Generated by Wrangler by running `wrangler types --env-interface CloudflareEnv cloudflare-env.d.ts` (hash: 9ef621dccad7efd28a46abbf030b22b2)
3-
// Runtime types generated with workerd@1.20260301.1 2026-03-03 nodejs_compat
2+
// Generated by Wrangler by running `wrangler types --env-interface CloudflareEnv cloudflare-env.d.ts` (hash: 4abe76a3fa06129f0308765cad91363b)
3+
// Runtime types generated with workerd@1.20260301.1 2026-03-03 global_fetch_strictly_public,nodejs_compat
44
declare namespace Cloudflare {
5-
interface GlobalProps {
6-
mainModule: typeof import("./.open-next/worker");
7-
}
85
interface Env {
96
HYPERDRIVE: Hyperdrive;
107
ASSETS: Fetcher;
118
COOKIE_SECRET: string;
12-
DATABASE_URL: string;
139
DISCORD_GUILD: string;
1410
DISCORD_ID: string;
1511
DISCORD_REDIRECT: string;
@@ -26,16 +22,15 @@ declare namespace Cloudflare {
2622
TURNSTILE_KEY: string;
2723
WRANGLER_BUILD_CONDITIONS: string;
2824
WRANGLER_BUILD_PLATFORM: string;
29-
SENTRY_AUTH_TOKEN: string;
30-
VERCEL_OIDC_TOKEN: string;
25+
WORKER_SELF_REFERENCE: Fetcher /* stardew-app */;
3126
}
3227
}
3328
interface CloudflareEnv extends Cloudflare.Env {}
3429
type StringifyValues<EnvType extends Record<string, unknown>> = {
3530
[Binding in keyof EnvType]: EnvType[Binding] extends string ? EnvType[Binding] : string;
3631
};
3732
declare namespace NodeJS {
38-
interface ProcessEnv extends StringifyValues<Pick<Cloudflare.Env, "COOKIE_SECRET" | "DATABASE_URL" | "DISCORD_GUILD" | "DISCORD_ID" | "DISCORD_REDIRECT" | "DISCORD_SECRET" | "DISCORD_TOKEN" | "FEEDBACK_WEBHOOK" | "LINEAR_API_KEY" | "LINEAR_BUG_LABEL" | "LINEAR_TEAM_ID" | "MIXPANEL_API" | "NEXT_PUBLIC_DEVELOPMENT" | "NEXT_PUBLIC_POSTHOG_HOST" | "NEXT_PUBLIC_POSTHOG_KEY" | "TURNSTILE_KEY" | "WRANGLER_BUILD_CONDITIONS" | "WRANGLER_BUILD_PLATFORM" | "SENTRY_AUTH_TOKEN" | "VERCEL_OIDC_TOKEN">> {}
33+
interface ProcessEnv extends StringifyValues<Pick<Cloudflare.Env, "COOKIE_SECRET" | "DISCORD_GUILD" | "DISCORD_ID" | "DISCORD_REDIRECT" | "DISCORD_SECRET" | "DISCORD_TOKEN" | "FEEDBACK_WEBHOOK" | "LINEAR_API_KEY" | "LINEAR_BUG_LABEL" | "LINEAR_TEAM_ID" | "MIXPANEL_API" | "NEXT_PUBLIC_DEVELOPMENT" | "NEXT_PUBLIC_POSTHOG_HOST" | "NEXT_PUBLIC_POSTHOG_KEY" | "TURNSTILE_KEY" | "WRANGLER_BUILD_CONDITIONS" | "WRANGLER_BUILD_PLATFORM">> {}
3934
}
4035

4136
// Begin runtime types

next.config.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
const { initOpenNextCloudflareForDev } = require("@opennextjs/cloudflare");
2-
3-
initOpenNextCloudflareForDev();
1+
if (process.env.NODE_ENV === "development") {
2+
const { initOpenNextCloudflareForDev } = require("@opennextjs/cloudflare");
3+
initOpenNextCloudflareForDev();
4+
}
45

56
/** @type {import('next').NextConfig} */
67
const nextConfig = {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"scripts": {
66
"build": "next build",
77
"build:turbo": "wrangler types --env-interface CloudflareEnv cloudflare-env.d.ts && next build --turbopack",
8-
"build:worker": "bunx opennextjs-cloudflare build",
8+
"build:worker": "wrangler types --env-interface CloudflareEnv cloudflare-env.d.ts && bunx opennextjs-cloudflare build",
99
"cf-typegen": "wrangler types --env-interface CloudflareEnv cloudflare-env.d.ts",
1010
"clean": "rimraf .next .open-next .turbo",
1111
"deploy": "bun scripts/opennext.mjs deploy",

src/db/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import * as schema from "./schema";
66

77
export type Db = MySql2Database<typeof schema>;
88

9-
// cache() scopes this to a single request — subsequent calls within the same
10-
// request return the same instance; a fresh pool is created for each new request.
119
export const getDb = cache(() => {
1210
const { env } = getCloudflareContext();
1311
return drizzle(
@@ -18,6 +16,7 @@ export const getDb = cache(() => {
1816
database: env.HYPERDRIVE.database,
1917
port: env.HYPERDRIVE.port,
2018
disableEval: true,
19+
connectionLimit: 1,
2120
}),
2221
{
2322
schema,

0 commit comments

Comments
 (0)