小编iKn*_*ing的帖子

Clerk 中间件在 Next 12.2.2 的生产中崩溃

尚未能够深入了解此问题的根本原因,但我正在尝试使用 NextJS 12.2.2 实现文员身份验证,并且我在开发环境中一切正常。然而,当我进入生产环境时,由于以下错误,我的网站在加载时立即崩溃:

ReferenceError: __import_unsupported is not defined
    at (vc/edge/function:14:2050)
    at (vc/edge/function:14:656)
    at (vc/edge/function:14:3107)
    at (vc/edge/function:14:656)
    at (vc/edge/function:67:13871)
    at (vc/edge/function:14:656)
    at (vc/edge/function:67:15731)
    at (vc/edge/function:14:656)
    at (vc/edge/function:67:27265)
    at (vc/edge/function:14:656)

ReferenceError: __import_unsupported is not defined
    at (external root " __import_unsupported('buffer')":1:0)
    at (webpack/bootstrap:21:0)
    at (node_modules/rfc4648/lib/index.mjs:11:15)
    at (webpack/bootstrap:21:0)
    at (node_modules/@clerk/nextjs/dist/server/clerk.js:5:18)
    at (webpack/bootstrap:21:0)
    at (node_modules/@clerk/nextjs/dist/server/index.js:4:21)
    at (webpack/bootstrap:21:0)
    at (node_modules/@clerk/nextjs/server.js:1:0)
    at (webpack/bootstrap:21:0)
Run Code Online (Sandbox Code Playgroud)

我的 Clerk middleware.js 文件:

import { withClerkMiddleware } from "@clerk/nextjs/server";
import { NextResponse } from "next/server";

export default withClerkMiddleware((req) => {
  return NextResponse.next(); …
Run Code Online (Sandbox Code Playgroud)

authentication middleware reactjs next.js clerk

2
推荐指数
1
解决办法
3510
查看次数

标签 统计

authentication ×1

clerk ×1

middleware ×1

next.js ×1

reactjs ×1