Compatibility flags for PosgreSQL

I am trying to build and deploy SvelteKit page with enabled flags: nodejs_compat or nodejs_compat_v2 https://developers.cloudflare.com/workers/configuration/compatibility-dates/#compatibility-flags

I am using Drizzle connector, but seems I run always into node compatibility issues, which are present on native postgres.js also.

Connectors are present in Hyperdrive: https://developers.cloudflare.com/hyperdrive/configuration/connect-to-postgres/#supported-drivers

Source code: https://github.com/bchainhub/dapp-sveltekit-boilerplate/tree/update/contrib-13

My questions:
Q1: Do I need to upgrade to paid plan for Node.js features support? (I am aware of Hyperdrive included in Paid plan)
Q2: What should I change to make Node.js API working on my Pages deployment?

Some of errors I am getting while deployment:

✘ [ERROR] Could not resolve "node:stream"
node_modules/postgres/cf/src/large.js:1:import Stream from 'node:stream'
The package "node:stream" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

error during build:
Error: Build failed with 8 errors:
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"
node_modules/postgres/cf/src/bytes.js:1:23: ERROR: Could not resolve "node:buffer"
node_modules/postgres/cf/src/connection.js:1:23: ERROR: Could not resolve "node:buffer"
node_modules/postgres/cf/src/connection.js:6:19: ERROR: Could not resolve "node:stream"


- page: core-dapp.pages.dev
- deployment: 580ce1e

I checked the examples here also: https://developers.cloudflare.com/hyperdrive/examples/
Was this page helpful?