Skip to content

bug(adapter/cloudflare): turborepo terminates the process in midway when using workerd as prerender environment #16396

@kumardeo

Description

@kumardeo

Astro Info

Astro                    v6.1.8
Node                     v22.21.1
System                   Linux (x64)
Package Manager          pnpm
Output                   static
Adapter                  @astrojs/cloudflare
Integrations             @astrojs/mdx
                         @astrojs/react
                         @astrojs/partytown
                         @vite-pwa/astro-integration

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

When migrating an astro app from 5 to 6 in turborepo, it behaves in a strange way when using cloudflare adapter and workerd as prerender environment.

My astro app is located at apps/web

When the build command is run in apps/web directory, it builds the app as expected.
Example:
(from root)
cd apps/web
pnpm run build

Logs:

✓ built in 269ms
21:36:22 [build] Server built in 33.83s
21:36:22 [build] Complete!

But, when the build command is run by turbo, it exits without fully building the app (mostly when prerendering phase begins) and no error at all.
Example:
(from root)
turbo run build

Logs:

web:build: 
21:28:31 [assets] Copying fonts (16 files)...
web:build: Using secrets defined in .env
web:build: 21:28:32 [vite] ✓ built in 9.50s
21:28:37 [WARN] [vite] src/pages/ssr-test/index.astro (25:18): "components" is not exported by "src/pages/ssr-test/_content.mdx", imported by "src/pages/ssr-test/index.astro".
web:build: Using secrets defined in .env
:sparkles: Parsed 2 valid header rules. (x2)

 Tasks:    5 successful, 5 total
Cached:    2 cached, 5 total
  Time:    41.713s

Observations:

Turbo terminates the process as soon as prerendering begins in workerd prerender environment, it does not terminate when prerenderEnvironment: 'node' is used in cloudflare adapter config.

I am not sure, but looks like when workerd environment is used, it does not block properly and turbo thinks execution is completed so terminates the process.

What's the expected result?

The app should build completely with workerd prerender environment when build command is run by turborepo.

Link to Minimal Reproducible Example

https://github.com/kumardeo/astro-repro-16396

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions