Auth0.ai tutorial fails with error

Hi,
I’m trying to run the ‘call your APIs on user’s behalf’ Auth for GenAI tutorial and get stuck with the following error:

Error: cookies was called outside a request scope. Read more:

src/middleware.ts (13:31) @ middleware

11 |
12 | const { origin } = new URL(request.url);

13 | const session = await auth0.getSession();
| ^
14 |
15 | // User does not have a session — redirect to login.
16 | if (!session) {

Has the been seen elsewhere?