Aha, got it working, for anyone who runs
Aha, got it working, for anyone who runs into this, in the end it was simpler than I thought, just need
compatibility_flags = [ "nodejs_compat" ]
in wrangler.toml
and then normal functions directory just works™. It took me a while to figure it out because most of the community resources, gh issues etc are slightly outdated and took me a while to understand that node_compat = true
is a build time thing not supported by pages and likely won't be (as it is legacy) and compatibility_flags
is the way to go!5 Replies
We're definitely trying to improve that story to scrub some of the node_compat usage, any that you can share so we can try to help other folks find the right info right away?
Sure, to make it work in pages, build only has an index.html and functions/hello.ts has normal postgres.js code
(will put it in github and upload shortly)
and for worker, this is the wrangler.toml
this was a part of the confusion, docs only refer to node_compat and worker code and when I try to translate that to pages code, I get the error
node_compat
is not supported by pages.. which led me to the rabbit hole of trying and making it work!
just a pages example in the official docs will be enough IMO
also, quick question, with functions part of pages, will workers eventually be phased out or are they expected to stay as a separate product?