Astro Site builds but page isn't working (error 500)

I have a website build on Astro (v.2.5.5) with Cloudflare adapter (v.6.3.0). Everything works fine on my local Wrangler environment. On Cloudflare server the page was deployed successfully, but I’ve got a 500 error.
I checked logs and found this:
"12:15:17 PM [ssr] Error: To use the new ReadableStream() constructor, enable the streams_enable_constructors feature flag.\n at W1 (functionsWorker-0.06190391811893625.js:1279:20)\n at async Ru (functionsWorker-0.06190391811893625.js:1630:11)\n at async Yn.Ti (functionsWorker-0.06190391811893625.js:2202:137)\n at async Yn.render (functionsWorker-0.06190391811893625.js:2173:17)\n at async Object.fetch (functionsWorker-0.06190391811893625.js:11445:15)"
I tried to add a wrangler.toml file:
compatibility_date = "2023-04-05" compatibility_flags = [ "transformstream_enable_standard_constructor", "streams_enable_constructors" ]
but without success.
How to force enable the streams_enable_constructors flag?

I found a solution:

  • In the Pages project Settings > Functions > Compatibility date, change the date to 2022-11-30 or newer, or
  • In the Pages project Settings > Functions > Compatibility Flags, add the transformstream_enable_standard_constructor and streams_enable_constructors flags.