Cannot use supabase serverless on cloudflare pages

Hey all I get this error on deployment : Error: Failed to publish your Function. Got error: Uncaught Error: No such module "node:events". This is my db setup:

import { drizzle } from 'drizzle-orm/postgres-js'
import postgres from 'postgres'
import { DATABASE_URL } from '$env/static/private';
import * as schema from "./schema"


if (!DATABASE_URL) throw new Error('DATABASE_URL is not set');

const client = postgres(DATABASE_URL, { prepare: false })

export const db = drizzle(DATABASE_URL,{schema});

import { drizzle } from 'drizzle-orm/postgres-js'
import postgres from 'postgres'
import { DATABASE_URL } from '$env/static/private';
import * as schema from "./schema"


if (!DATABASE_URL) throw new Error('DATABASE_URL is not set');

const client = postgres(DATABASE_URL, { prepare: false })

export const db = drizzle(DATABASE_URL,{schema});
I tried everything, but could not get any success on this
1 Reply
SheldonFromBBT
SheldonFromBBTOP4d ago
These are the some logs : ▲ [WARNING] The package "node:stream" wasn't found on the file system but is built into node. Your Worker may throw errors at runtime unless you enable the "nodejs_compat" compatibility flag. Refer to https://developers.cloudflare.com/workers/runtime-apis/nodejs/ for more details. Imported from: 13:59:59.831 - ../../node_modules/.pnpm/[email protected]/node_modules/postgres/cf/src/large.js 13:59:59.831 - ../../node_modules/.pnpm/[email protected]/node_modules/postgres/cf/src/connection.js ▲ [WARNING] The package "node:events" wasn't found on the file system but is built into node. 13:59:59.832 13:59:59.833 Your Worker may throw errors at runtime unless you enable the "nodejs_compat" compatibility flag. Refer to https://developers.cloudflare.com/workers/runtime-apis/nodejs/ for more details. Imported from: 13:59:59.833 - ../../node_modules/.pnpm/[email protected]/node_modules/postgres/cf/polyfills.js Help would be really appreciated!

Did you find this page helpful?