店员 - 当我尝试在 nextjs 项目中使用 vercel 进行部署时出现中间件错误

问题描述 投票:0回答:1

我在尝试在 Vercel 中部署时遇到以下错误,但我已经按照它的说明将它要求我提供的密钥放入了我的应用程序中。几次部署前我没有收到这样的错误。

可能是什么原因?

这些是我遇到的错误;

[GET] [middleware: "middleware"] / reason=EDGE_FUNCTION_INVOCATION_FAILED, status=500, user_error=true

--

Error: Missing Clerk Secret Key or API Key. Go to https://dashboard.clerk.com and get your key for your instance.
at (node_modules/@clerk/backend/dist/esm/index.js:697:10)
at (node_modules/@clerk/backend/dist/esm/index.js:2767:2)
at (node_modules/@clerk/backend/dist/esm/index.js:2874:11)
at (node_modules/@clerk/nextjs/dist/esm/server/authenticateRequest.js:16:27)
at (node_modules/@clerk/nextjs/dist/esm/server/authMiddleware.js:64:31)
at (node_modules/next/dist/esm/server/web/adapter.js:157:15)

--

和一些文件;

import { authMiddleware } from "@clerk/nextjs";
export default authMiddleware({
  publicRoutes: ["/","/board"],
});
 
export const config = {
  matcher: ["/((?!.+\\.[\\w]+$|_next).*)", "/", "/(api|trpc)(.*)"],
};

--

NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_blablabblablablablablablablabla
CLERK_SECRET_KEY=sk_test_blablablablablablablablblablabla
NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in
NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up
NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL=/
NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL=/
next.js deployment vercel clerk
1个回答
0
投票

也遇到这个问题了!这是我的 package.json:

{
  "name": "vanilla-next",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "@clerk/nextjs": "^4.29.7",
    "@prisma/client": "^5.9.1",
    "next": "14.1.0",
    "react": "^18",
    "react-dom": "^18"
  },
  "prisma": {
    "seed": "ts-node prisma/seed.mjs"
  },
  "devDependencies": {
    "@types/node": "^20.11.16",
    "@types/react": "^18",
    "@types/react-dom": "^18",
    "autoprefixer": "^10.0.1",
    "eslint": "^8",
    "eslint-config-next": "14.1.0",
    "postcss": "^8",
    "prisma": "^5.9.1",
    "tailwindcss": "^3.3.0",
    "ts-node": "^10.9.2",
    "typescript": "^5.3.3"
  }
}

© www.soinside.com 2019 - 2024. All rights reserved.