Next.js Discord

Discord Forum

Failed to collect page data

Unanswered
Brown bear posted this in #help-forum
Open in Discord
Brown bearOP
I'm not entirely sure why, but the page below does not work with the export const runtime = "edge" flag, but does without it.

import { db } from "~/utils";

export const dynamic = "force-dynamic";
export const runtime = "edge";

export default async function Profile() {
  const test = await db.query.users.findFirst();

  console.log(test);

  return <div></div>;
}


Here's the build output:
@knighthacks/2024:build:    Collecting page data ...
@knighthacks/2024:build:  ⚠ Using edge runtime on a page currently disables static generation for that page
@knighthacks/2024:build: SyntaxError: Invalid regular expression: /^((?<username>[^:]*)(:(?<password>.*))?@)?((?<host>[^:\\[\\]]*)|(\\[(?<host_br>[^\\[\\]]*)\\]))(:(?<port>[0-9]*))?$/su: Lone quantifier brackets
@knighthacks/2024:build:     at RegExp (<anonymous>)
@knighthacks/2024:build:     at 1183 (/Users/mirage/dev/knighthacks/apps/2024/.next/server/app/test/page.js:127:17154)
@knighthacks/2024:build:     at Function.__webpack_require__ (/Users/mirage/dev/knighthacks/apps/2024/.next/server/edge-runtime-webpack.js:25:42)
@knighthacks/2024:build:     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
@knighthacks/2024:build: 
@knighthacks/2024:build: > Build error occurred
@knighthacks/2024:build: Error: Failed to collect page data for /test
@knighthacks/2024:build:     at /Users/mirage/dev/knighthacks/node_modules/.pnpm/next@14.1.0_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/build/utils.js:1258:15
@knighthacks/2024:build:     at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
@knighthacks/2024:build:   type: 'Error'
@knighthacks/2024:build: }
@knighthacks/2024:build:  ELIFECYCLE  Command failed with exit code 1.
@knighthacks/2024:build:  ELIFECYCLE  Command failed with exit code 1.
@knighthacks/2024:build: ERROR: command finished with error: command (/Users/mirage/dev/knighthacks/apps/2024) /Users/mirage/.nvm/versions/node/v20.12.2/bin/pnpm run build exited (1)
@knighthacks/2024#build: command (/Users/mirage/dev/knighthacks/apps/2024) /Users/mirage/.nvm/versions/node/v20.12.2/bin/pnpm run build exited (1)


I'm using Drizzle ORM with Turso and I'm simply trying to make a db call in an rsc using the edge runtime.

2 Replies

Brown bearOP
Interestingly upgrading to next 14.2.0 fixed my issue :/
Could anyone explain why this may have solved me issue?