From 4154274f46b340a2f8197ffb71948d1f21f83e19 Mon Sep 17 00:00:00 2001 From: nickreynolds Date: Tue, 7 Jan 2025 13:46:02 -0500 Subject: [PATCH 1/5] fix: disable edge runtime by default to enable windows development --- README.md | 5 ++++- apps/nextjs/src/app/api/auth/[...nextauth]/route.ts | 3 ++- apps/nextjs/src/app/api/trpc/[trpc]/route.ts | 3 ++- apps/nextjs/src/app/page.tsx | 3 ++- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 13f4ff015..6b2d98c66 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,10 @@ tooling ## Quick Start > **Note** -> The [db](./packages/db) package is preconfigured to use Supabase and is **edge-bound** with the [Vercel Postgres](https://github.com/vercel/storage/tree/main/packages/postgres) driver. If you're using something else, make the necessary modifications to the [schema](./packages/db/src/schema.ts) as well as the [client](./packages/db/src/index.ts) and the [drizzle config](./packages/db/drizzle.config.ts). If you want to switch to non-edge database driver, remove `export const runtime = "edge";` [from all pages and api routes](https://github.com/t3-oss/create-t3-turbo/issues/634#issuecomment-1730240214). +> Due to a [bug](https://github.com/vercel/next.js/issues/53562) affecting windows development, the edge runtime is currently disabled by default. If your environment supports it, you can enable the edge runtime by adding the line `export const runtime = "edge";` [to all pages and api routes](https://github.com/t3-oss/create-t3-turbo/issues/634#issuecomment-1730240214). The pages and routes included in this template include this line commented out, for illustration purposes. + +> **Note** +> The [db](./packages/db) package is preconfigured to use Supabase and is **edge-bound** with the [Vercel Postgres](https://github.com/vercel/storage/tree/main/packages/postgres) driver. If you're using something else, make the necessary modifications to the [schema](./packages/db/src/schema.ts) as well as the [client](./packages/db/src/index.ts) and the [drizzle config](./packages/db/drizzle.config.ts). To get it running, follow the steps below: diff --git a/apps/nextjs/src/app/api/auth/[...nextauth]/route.ts b/apps/nextjs/src/app/api/auth/[...nextauth]/route.ts index 22ddf2c4f..dcf224912 100644 --- a/apps/nextjs/src/app/api/auth/[...nextauth]/route.ts +++ b/apps/nextjs/src/app/api/auth/[...nextauth]/route.ts @@ -3,7 +3,8 @@ import { NextRequest, NextResponse } from "next/server"; import { handlers, isSecureContext } from "@acme/auth"; -export const runtime = "edge"; +// Uncomment this line to enable edge runtime if your environment supports it +// export const runtime = "edge"; const EXPO_COOKIE_NAME = "__acme-expo-redirect-state"; const AUTH_COOKIE_PATTERN = /authjs\.session-token=([^;]+)/; diff --git a/apps/nextjs/src/app/api/trpc/[trpc]/route.ts b/apps/nextjs/src/app/api/trpc/[trpc]/route.ts index 4a0ef6c43..6ec6fa5c9 100644 --- a/apps/nextjs/src/app/api/trpc/[trpc]/route.ts +++ b/apps/nextjs/src/app/api/trpc/[trpc]/route.ts @@ -3,7 +3,8 @@ import { fetchRequestHandler } from "@trpc/server/adapters/fetch"; import { appRouter, createTRPCContext } from "@acme/api"; import { auth } from "@acme/auth"; -export const runtime = "edge"; +// Uncomment this line to enable edge runtime if your environment supports it +// export const runtime = "edge"; /** * Configure basic CORS headers diff --git a/apps/nextjs/src/app/page.tsx b/apps/nextjs/src/app/page.tsx index 0e4df9fb0..0d2abca9c 100644 --- a/apps/nextjs/src/app/page.tsx +++ b/apps/nextjs/src/app/page.tsx @@ -8,7 +8,8 @@ import { PostList, } from "./_components/posts"; -export const runtime = "edge"; +// Uncomment this line to enable edge runtime if your environment supports it +// export const runtime = "edge"; export default function HomePage() { // You can await this here if you don't want to show Suspense fallback below From a2891b89753c2c89df6fe608f994d15e3bc16826 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Tue, 7 Jan 2025 20:38:16 +0100 Subject: [PATCH 2/5] Discard changes to README.md --- README.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/README.md b/README.md index 6b2d98c66..13f4ff015 100644 --- a/README.md +++ b/README.md @@ -76,10 +76,7 @@ tooling ## Quick Start > **Note** -> Due to a [bug](https://github.com/vercel/next.js/issues/53562) affecting windows development, the edge runtime is currently disabled by default. If your environment supports it, you can enable the edge runtime by adding the line `export const runtime = "edge";` [to all pages and api routes](https://github.com/t3-oss/create-t3-turbo/issues/634#issuecomment-1730240214). The pages and routes included in this template include this line commented out, for illustration purposes. - -> **Note** -> The [db](./packages/db) package is preconfigured to use Supabase and is **edge-bound** with the [Vercel Postgres](https://github.com/vercel/storage/tree/main/packages/postgres) driver. If you're using something else, make the necessary modifications to the [schema](./packages/db/src/schema.ts) as well as the [client](./packages/db/src/index.ts) and the [drizzle config](./packages/db/drizzle.config.ts). +> The [db](./packages/db) package is preconfigured to use Supabase and is **edge-bound** with the [Vercel Postgres](https://github.com/vercel/storage/tree/main/packages/postgres) driver. If you're using something else, make the necessary modifications to the [schema](./packages/db/src/schema.ts) as well as the [client](./packages/db/src/index.ts) and the [drizzle config](./packages/db/drizzle.config.ts). If you want to switch to non-edge database driver, remove `export const runtime = "edge";` [from all pages and api routes](https://github.com/t3-oss/create-t3-turbo/issues/634#issuecomment-1730240214). To get it running, follow the steps below: From e54eb275399b7dff85f0e12cc22971fb09faae36 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Tue, 7 Jan 2025 20:39:18 +0100 Subject: [PATCH 3/5] Apply suggestions from code review --- apps/nextjs/src/app/api/trpc/[trpc]/route.ts | 2 -- apps/nextjs/src/app/page.tsx | 2 -- 2 files changed, 4 deletions(-) diff --git a/apps/nextjs/src/app/api/trpc/[trpc]/route.ts b/apps/nextjs/src/app/api/trpc/[trpc]/route.ts index 6ec6fa5c9..e407ab80a 100644 --- a/apps/nextjs/src/app/api/trpc/[trpc]/route.ts +++ b/apps/nextjs/src/app/api/trpc/[trpc]/route.ts @@ -3,8 +3,6 @@ import { fetchRequestHandler } from "@trpc/server/adapters/fetch"; import { appRouter, createTRPCContext } from "@acme/api"; import { auth } from "@acme/auth"; -// Uncomment this line to enable edge runtime if your environment supports it -// export const runtime = "edge"; /** * Configure basic CORS headers diff --git a/apps/nextjs/src/app/page.tsx b/apps/nextjs/src/app/page.tsx index 0d2abca9c..d04f50c12 100644 --- a/apps/nextjs/src/app/page.tsx +++ b/apps/nextjs/src/app/page.tsx @@ -8,8 +8,6 @@ import { PostList, } from "./_components/posts"; -// Uncomment this line to enable edge runtime if your environment supports it -// export const runtime = "edge"; export default function HomePage() { // You can await this here if you don't want to show Suspense fallback below From b324e4fd8b1546cb46c5f7b0ee2d3838f339fa5f Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Tue, 7 Jan 2025 20:39:34 +0100 Subject: [PATCH 4/5] Update apps/nextjs/src/app/api/auth/[...nextauth]/route.ts --- apps/nextjs/src/app/api/auth/[...nextauth]/route.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/apps/nextjs/src/app/api/auth/[...nextauth]/route.ts b/apps/nextjs/src/app/api/auth/[...nextauth]/route.ts index dcf224912..9bca462c6 100644 --- a/apps/nextjs/src/app/api/auth/[...nextauth]/route.ts +++ b/apps/nextjs/src/app/api/auth/[...nextauth]/route.ts @@ -3,8 +3,6 @@ import { NextRequest, NextResponse } from "next/server"; import { handlers, isSecureContext } from "@acme/auth"; -// Uncomment this line to enable edge runtime if your environment supports it -// export const runtime = "edge"; const EXPO_COOKIE_NAME = "__acme-expo-redirect-state"; const AUTH_COOKIE_PATTERN = /authjs\.session-token=([^;]+)/; From 581ed1f1f5de9b26268bae97deff360bf2e588ba Mon Sep 17 00:00:00 2001 From: juliusmarminge Date: Sun, 12 Jan 2025 20:41:56 +0100 Subject: [PATCH 5/5] fmt --- apps/nextjs/src/app/api/auth/[...nextauth]/route.ts | 1 - apps/nextjs/src/app/api/trpc/[trpc]/route.ts | 1 - apps/nextjs/src/app/page.tsx | 1 - 3 files changed, 3 deletions(-) diff --git a/apps/nextjs/src/app/api/auth/[...nextauth]/route.ts b/apps/nextjs/src/app/api/auth/[...nextauth]/route.ts index 9bca462c6..31f85f5b1 100644 --- a/apps/nextjs/src/app/api/auth/[...nextauth]/route.ts +++ b/apps/nextjs/src/app/api/auth/[...nextauth]/route.ts @@ -3,7 +3,6 @@ import { NextRequest, NextResponse } from "next/server"; import { handlers, isSecureContext } from "@acme/auth"; - const EXPO_COOKIE_NAME = "__acme-expo-redirect-state"; const AUTH_COOKIE_PATTERN = /authjs\.session-token=([^;]+)/; diff --git a/apps/nextjs/src/app/api/trpc/[trpc]/route.ts b/apps/nextjs/src/app/api/trpc/[trpc]/route.ts index e407ab80a..517035155 100644 --- a/apps/nextjs/src/app/api/trpc/[trpc]/route.ts +++ b/apps/nextjs/src/app/api/trpc/[trpc]/route.ts @@ -3,7 +3,6 @@ import { fetchRequestHandler } from "@trpc/server/adapters/fetch"; import { appRouter, createTRPCContext } from "@acme/api"; import { auth } from "@acme/auth"; - /** * Configure basic CORS headers * You should extend this to match your needs diff --git a/apps/nextjs/src/app/page.tsx b/apps/nextjs/src/app/page.tsx index d04f50c12..b922b50ec 100644 --- a/apps/nextjs/src/app/page.tsx +++ b/apps/nextjs/src/app/page.tsx @@ -8,7 +8,6 @@ import { PostList, } from "./_components/posts"; - export default function HomePage() { // You can await this here if you don't want to show Suspense fallback below void api.post.all.prefetch();