The Edge Function "middleware" is referencing unsupported modules: - @clerk: #components, #server
Unanswered
Scottish Fold posted this in #help-forum
Scottish FoldOP
getting this error all the time, tried also with middleware.ts
import { authMiddleware } from "@clerk/nextjs/server";
System:
OS: Windows 11 10.0.22631
CPU: (16) x64 11th Gen Intel(R) Core(TM) i9-11900 @ 2.50GHz
Memory: 7.71 GB / 31.86 GB
Binaries:
Node: 18.17.0 - C:\Program Files\nodejs\node.EXE
npm: 9.6.7 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: Chromium (122.0.2365.92), ChromiumDev (123.0.2420.10)
Internet Explorer: 11.0.22621.1
npmPackages:
@clerk/nextjs: ^4.29.9 => 4.29.9
@hookform/resolvers: ^3.3.4 => 3.3.4
@radix-ui/react-dialog: ^1.0.5 => 1.0.5
@radix-ui/react-label: ^2.0.2 => 2.0.2
@radix-ui/react-slot: ^1.0.2 => 1.0.2
@types/node: ^20 => 20.11.25
@types/react: ^18 => 18.2.64
@types/react-dom: ^18 => 18.2.21
autoprefixer: ^10.0.1 => 10.4.18
axios: ^1.6.7 => 1.6.7
class-variance-authority: ^0.7.0 => 0.7.0
clsx: ^2.1.0 => 2.1.0
eslint: ^8 => 8.57.0
eslint-config-next: 14.1.3 => 14.1.3
lucide-react: ^0.350.0 => 0.350.0
next: 14.1.3 => 14.1.3
openai: ^3.3.0 => 3.3.0
postcss: ^8 => 8.4.35
react: ^18 => 18.2.0
react-dom: ^18 => 18.2.0
react-hook-form: ^7.51.0 => 7.51.0
tailwind-merge: ^2.2.1 => 2.2.1
tailwindcss: ^3.3.0 => 3.4.1
tailwindcss-animate: ^1.0.7 => 1.0.7
typescript: ^5 => 5.4.2
zod: ^3.22.4 => 3.22.4
on vercel i get this bug, on local it works.
import { authMiddleware } from "@clerk/nextjs/server";
System:
OS: Windows 11 10.0.22631
CPU: (16) x64 11th Gen Intel(R) Core(TM) i9-11900 @ 2.50GHz
Memory: 7.71 GB / 31.86 GB
Binaries:
Node: 18.17.0 - C:\Program Files\nodejs\node.EXE
npm: 9.6.7 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: Chromium (122.0.2365.92), ChromiumDev (123.0.2420.10)
Internet Explorer: 11.0.22621.1
npmPackages:
@clerk/nextjs: ^4.29.9 => 4.29.9
@hookform/resolvers: ^3.3.4 => 3.3.4
@radix-ui/react-dialog: ^1.0.5 => 1.0.5
@radix-ui/react-label: ^2.0.2 => 2.0.2
@radix-ui/react-slot: ^1.0.2 => 1.0.2
@types/node: ^20 => 20.11.25
@types/react: ^18 => 18.2.64
@types/react-dom: ^18 => 18.2.21
autoprefixer: ^10.0.1 => 10.4.18
axios: ^1.6.7 => 1.6.7
class-variance-authority: ^0.7.0 => 0.7.0
clsx: ^2.1.0 => 2.1.0
eslint: ^8 => 8.57.0
eslint-config-next: 14.1.3 => 14.1.3
lucide-react: ^0.350.0 => 0.350.0
next: 14.1.3 => 14.1.3
openai: ^3.3.0 => 3.3.0
postcss: ^8 => 8.4.35
react: ^18 => 18.2.0
react-dom: ^18 => 18.2.0
react-hook-form: ^7.51.0 => 7.51.0
tailwind-merge: ^2.2.1 => 2.2.1
tailwindcss: ^3.3.0 => 3.4.1
tailwindcss-animate: ^1.0.7 => 1.0.7
typescript: ^5 => 5.4.2
zod: ^3.22.4 => 3.22.4
on vercel i get this bug, on local it works.
3 Replies
Scottish FoldOP
import { NextResponse } from "@clerk/nextjs";
export function middleware(req: NextRequest) {
const { pathname } = req.nextUrl;
const path = pathname.split('/').slice(1);
if (path[0] === 'api' || path[0] === 'trpc') {
return NextResponse.next();
}
if (path.length === 0 || ['_next'].includes(path[0])) {
return NextResponse.next();
}
return NextResponse.json({ error: 'Not found' }, { status: 404 });
}
export const config = {
runtime: 'nodejs',
matcher: ['/:path*'],
};
export const config = {
matcher: ['/:path*'],
};no it didn't work....