t3-oss / create-t3-turbo

Clean and simple starter repo using the T3 Stack along with Expo React Native

Home Page:https://turbo.t3.gg

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bug: Calling auth in middleware cause a error

HassanDev13 opened this issue · comments

Provide environment information

System:
OS: Linux 6.5 Ubuntu 23.10 23.10 (Mantic Minotaur)
CPU: (12) x64 12th Gen Intel(R) Core(TM) i7-1255U
Memory: 3.82 GB / 15.25 GB
Container: Yes
Shell: 5.2.15 - /bin/bash
Binaries:
Node: 20.10.0 - ~/.nvm/versions/node/v20.10.0/bin/node
npm: 10.2.3 - ~/.nvm/versions/node/v20.10.0/bin/npm
pnpm: 8.12.0 - ~/.nvm/versions/node/v20.10.0/bin/pnpm

Describe the bug

when i try to call :
const

get error :

`../../node_modules/@mapbox/node-pre-gyp/lib/util/nw-pre-gyp/index.html
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders

<!doctype html>
|
| `

my code :
middleware.ts
`
import type { NextRequest } from "next/server";
import { NextResponse } from "next/server";

import { auth } from "@acme/auth";

export default async function middleware(req: NextRequest) {
const session = await auth();
return NextResponse.next();
}

export const config = {
matcher: ["/"],
};
`

can any one help ?

Link to reproduction

N/A

To reproduce

after i declare :
const session = await auth();

Additional information

No response

You have a node dependency leaking in from the auth package probably. Have you changed the database driver by any chance? It must be edge compatible to run on middleware

Cant be of more assistance without a reproduction repo

I am using Supabase with Drizzle, and I want to deploy it to a VPS. Is this possible?

What driver? It should work if you follow this: https://github.com/juliusmarminge/t3-supaedge

I'm a bit uncertain about setting up your vps to run middleware though, as Ideally you'd want that on the edge close to your users. But that's beyond your issue here...

Seems great ! I will try to implement turbo on it, Thank you for your help.