sveltekit and node errors on build

Trying to use Sveltekit, with Supabase and Drizzle ORM preferably.
  • I've put nodejs_compat in the compatibility flags in both preview and production
  • Node version is 18 (set via environment variable)
  • I'm using build engine 1
  • Using Sveltekit.
  • my postgres client instantiation is in $lib/server/ which I'm told makes it definitely server only
  • Using the cloudflare sveltekit adapter.
    node_modules/postgres/cf/polyfills.js:1:29: ERROR: Could not resolve "node:events"
    node_modules/postgres/cf/polyfills.js:2:23: ERROR: Could not resolve "node:buffer"

    Cant seem to find anything online why it'd be throwing this.
Was this page helpful?