Skip to content

Commit eb18030

Browse files
committed
Native node.js middleware support
1 parent aff2aab commit eb18030

File tree

5 files changed

+5
-4
lines changed

5 files changed

+5
-4
lines changed

bun.lockb

142 Bytes
Binary file not shown.

middleware.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,6 @@ export async function middleware(request: NextRequest) {
4545
}
4646

4747
export const config = {
48+
runtime: 'nodejs',
4849
matcher: ['/((?!api|_next/static|_next/image|favicon.ico).*)']
4950
}

next.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ const withBundleAnalyzer = initializeBundleAnalyzer({
1111
const nextConfig: NextConfig = {
1212
output: 'standalone',
1313
experimental: {
14-
turbo: {}
14+
turbo: {},
15+
nodeMiddleware: true
1516
}
1617
}
1718

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"drizzle-orm": "^0.39.3",
2222
"jose": "^5.9.6",
2323
"lucide-react": "^0.474.0",
24-
"next": "15.1.6",
24+
"next": "^15.2.0-canary.54",
2525
"next-themes": "^0.4.4",
2626
"postgres": "^3.4.5",
2727
"react": "19.0.0",

src/lib/db/queries.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@ import { verifyToken } from '@/lib/auth/session'
44

55
import { db } from './drizzle'
66
import { activityLogs, clusterMembers, clusters, secrets, users } from './schema'
7-
import { randomBytes } from 'crypto'
87
import { desc, eq } from 'drizzle-orm'
98

109
// TODO: Refactor logic
1110
export async function getAuthSecret() {
1211
const secret = await db.select().from(secrets).where(eq(secrets.key, 'auth_secret')).limit(1)
1312

1413
if (secret.length === 0) {
15-
const newSecret = randomBytes(32).toString('hex')
14+
const newSecret = crypto.randomBytes(32).toString('hex')
1615
try {
1716
await db.insert(secrets).values({ key: 'auth_secret', value: newSecret })
1817
} catch (error) {

0 commit comments

Comments
 (0)