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:
- page: core-dapp.pages.dev
- deployment: 580ce1e
I checked the examples here also: https://developers.cloudflare.com/hyperdrive/examples/17 Replies
i just ran into this exact same error (using sveltekit + postgres.js). were you able to resolve it?
@vytskalt so far no solution. Seems this is serious bug on side of Cloudflare. I am trying to resolve with Drizzle ORM but same issues. I will update here if some news will occur. @Community Champion should I report bug? If yes, where?
?pings
Please do not ping community members for non-moderation reasons. Doing so will not solve your issue faster and will make people less likely to want to help you.
Oh sorry, didn't know. I will found out myself.
@vytskalt Sent to support. When I will get any reply, I will reveal solution here.
Similar error related for Next.js is here: https://discord.com/channels/595317990191398933/1287862192712192113
One additional note to the topic:
- I have paid pages/workers plan
- Hyperdrive is available for me
No other updates so far about the topic.
Im having this exact issue too after implementing svelte, but im not using sveltekit
My
ResponseCode.ts
and the token.ts
file thats throwing the error
It specifically targets the ResponseCode.ts
file for some reason and I have no idea why
EventContext.ts
is in the same directory as @base
I think the issue is not related to framework, because I am aware of issues for React also. You may be in same category as us. I am still waiting for support team to answer. Seems no really priority to them. I will recommend you will raise support ticket as well, it may be faster answer for you. I will appreciate sharing any feedback from you @Register Thank you for contributing to thread.
Actually we fixed it
It was an issue with our tsconfig
Reply from the Cloudflare support:
Please consider the following recommendations:
1. Change the NODE_VERSION to v18.
2. Set the compatibility date to the current date.
Did it work?
@Register Not at all. Mr. Sugar (Account Manager) has acknowledged the issues and malfunctioning services Cloudflare provides, with no resolution in sight. I strongly recommend discontinuing Cloudflare services where feasible. Our team is currently migrating away due to their persistent technical incompetence and lack of professional reliability.
Yeah I've certainly had my own issues but I did overcome them.
Currently the Cloudflare's bug is not possible to resolve. There is malfunction in Hyperdrive and D1, I will not recommend to use it even in future because my experiences with Cloudflare's development team. Internal processes were failing. But if you want to do some development possible, please not production. I am currently removing anything related to Cloudflare in our application.
I received new recommendation as:
- do not use auto-adapter (BTW this is not working for me either)
svelte.config.js
wrangler.toml
None of those is helping me. And after discussion with SvelteKit developer community not recommended either.
I feel like I'm experiencing the same thing...
Trying to use "pg" (https://www.npmjs.com/package/pg) with RemixJS and getting this errors on build :
- The package "stream" wasn't found on the file system but is built into node.
- Add the "nodejs_compat" compatibility flag to your Pages project and make sure to prefix the module name with "node:" to enable Node.js compatibility.
- ../node_modules/.pnpm/[email protected]/node_modules/pg-cloudflare/dist/index.js:1:29: ERROR: Could not resolve "events"
And I tried searching the web for hours without finding any real answer on how to solve this.
Is this really this big of an issue? how does anyone use postgres without Hyperdrive on Cloudflare? What am I missing?
npm
pg
PostgreSQL client - pure javascript & libpq with the same API. Latest version: 8.13.1, last published: 11 days ago. Start using pg in your project by running
npm i pg
. There are 10245 other projects in the npm registry using pg.hi folks - were you guys able to get the deploy working?
I didn’t