Error: Failed to collect page data for /api/company-search/[name]

// db

import { drizzle } from "drizzle-orm/libsql";
import { createClient } from "@libsql/client/web";

const client = createClient({
url: process.env.DATABASE_URL,
authToken: process.env.DATABASE_AUTH_TOKEN,
});

export const db = drizzle(client);


// norwegianOrgs.ts


import { text, sqliteTable, index } from "drizzle-orm/sqlite-core";

export const norwegianOrgs = sqliteTable(
"norwegianOrgs",
{
orgType: text("orgType").notNull().unique(),
orgName: text("orgName").notNull(),
},
(table) => {
return {
orgType_idx: index("orgType_idx").on(table.orgType),
};
}
);




// company search
import { db } from "@/app/db";
import { norwegianOrgs } from "@/app/db/schema/norwegianOrgs";


const norData = await db.select().from(norwegianOrgs).all();
console.log(norData);
// db

import { drizzle } from "drizzle-orm/libsql";
import { createClient } from "@libsql/client/web";

const client = createClient({
url: process.env.DATABASE_URL,
authToken: process.env.DATABASE_AUTH_TOKEN,
});

export const db = drizzle(client);


// norwegianOrgs.ts


import { text, sqliteTable, index } from "drizzle-orm/sqlite-core";

export const norwegianOrgs = sqliteTable(
"norwegianOrgs",
{
orgType: text("orgType").notNull().unique(),
orgName: text("orgName").notNull(),
},
(table) => {
return {
orgType_idx: index("orgType_idx").on(table.orgType),
};
}
);




// company search
import { db } from "@/app/db";
import { norwegianOrgs } from "@/app/db/schema/norwegianOrgs";


const norData = await db.select().from(norwegianOrgs).all();
console.log(norData);
3 Replies
villainy
villainyOP12mo ago
getting this eror when trying to build for the edge runtime it works in dev and node runtime tho
villainy
villainyOP12mo ago
villainy
villainyOP12mo ago
{
"compilerOptions": {
"lib": ["dom", "dom.iterable", "esnext"],
"paths": {
"@/*": ["./*"]
},
"allowJs": true,
"skipLibCheck": true,
"strict": false,
"noEmit": true,
"incremental": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"target": "es2017",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"plugins": [
{
"name": "next"
}
]
},
"include": ["next-env.d.ts", ".next/types/**/*.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}
{
"compilerOptions": {
"lib": ["dom", "dom.iterable", "esnext"],
"paths": {
"@/*": ["./*"]
},
"allowJs": true,
"skipLibCheck": true,
"strict": false,
"noEmit": true,
"incremental": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"target": "es2017",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"plugins": [
{
"name": "next"
}
]
},
"include": ["next-env.d.ts", ".next/types/**/*.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}
import type { Config } from "drizzle-kit";
import { cwd } from "node:process";
import { loadEnvConfig } from "@next/env";

loadEnvConfig(cwd());

export default {
schema: "./app/db/schema/*.ts",
out: "./app/db/migrations",
driver: "turso",
dbCredentials: {
url: process.env.DATABASE_URL,
authToken: process.env.DATABASE_AUTH_TOKEN,
},
verbose: true,
strict: true,
} as Config;
import type { Config } from "drizzle-kit";
import { cwd } from "node:process";
import { loadEnvConfig } from "@next/env";

loadEnvConfig(cwd());

export default {
schema: "./app/db/schema/*.ts",
out: "./app/db/migrations",
driver: "turso",
dbCredentials: {
url: process.env.DATABASE_URL,
authToken: process.env.DATABASE_AUTH_TOKEN,
},
verbose: true,
strict: true,
} as Config;
downgraded next version and it worked
Want results from more Discord servers?
Add your server