# Meeting Edge runtime issue migrating to @auth0/nextjs-auth0 v0.4

**URL:** <https://community.auth0.com/t/meeting-edge-runtime-issue-migrating-to-auth0-nextjs-auth0-v0-4/182610>\
**Category:** Get Help\
**Tags:** sdks-quickstarts, nextjs-auth0\
**Created:** [February 21, 2025, 7:07pm UTC](https://community.auth0.com/t/meeting-edge-runtime-issue-migrating-to-auth0-nextjs-auth0-v0-4/182610 "2025-02-21T19:07:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lzh](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/lzh/32/72638_2.png) [@lzh](https://community.auth0.com/u/lzh)\
**Post date:** [February 21, 2025, 7:07pm UTC](https://community.auth0.com/t/meeting-edge-runtime-issue-migrating-to-auth0-nextjs-auth0-v0-4/182610/1 "2025-02-21T19:07:42Z")

</div>

Hi,

I’m migrating to @auth0/nextjs-auth0 v0.4 following the guide in the github doc. I’m meeting an issue where when the auth0 page tries to call `/api/callback` it raise error

```auto
!!!!!!!!url: /auth/callback
[Error: A Node.js API is used (setImmediate) which is not supported in the Edge Runtime.
Learn more: https://nextjs.org/docs/api-reference/edge-runtime]
 ⨯ uncaughtException: [Error: A Node.js API is used (setImmediate) which is not supported in the Edge Runtime.

```

Not sure what this happens as from my understanding, this path is offered by the middle ware.

```auto
import type { NextRequest } from "next/server";

import { middleware as userPagesMiddleware } from "@/app/(ui)/(user)/u/middleware";
import { auth0 } from "@/auth0";

export async function middleware(request: NextRequest) {
  console.log(`!!!!!!!!url: ${request.nextUrl.pathname}`);
  // auth0 middleware registration
  const authRes = await auth0.middleware(request);
  console.log(` ~~~~~~~~~~~~~~~~~~~~~~~~~ `);

  return authRes;
}

```

---

<div class="post-metadata">

**Author:** ![lzh](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/lzh/32/72638_2.png) [@lzh](https://community.auth0.com/u/lzh)\
**Post date:** [February 21, 2025, 7:17pm UTC](https://community.auth0.com/t/meeting-edge-runtime-issue-migrating-to-auth0-nextjs-auth0-v0-4/182610/2 "2025-02-21T19:17:30Z")

</div>

Found the issue. Turns out all the code in constructing auth0 client should also be edge-compatible.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [March 7, 2025, 7:17pm UTC](https://community.auth0.com/t/meeting-edge-runtime-issue-migrating-to-auth0-nextjs-auth0-v0-4/182610/3 "2025-03-07T19:17:58Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
