withastro / adapters

Home for Astro's core maintained adapters
47 stars 26 forks source link

Deploying to CF Pages with a Vue Island is broken #207

Closed kalepail closed 3 months ago

kalepail commented 3 months ago

Astro Info

Astro                    v4.5.12
Node                     v18.19.0
System                   macOS (arm64)
Package Manager          npm
Output                   server
Adapter                  @astrojs/cloudflare
Integrations             @astrojs/vue
                         @astrojs/tailwind

Describe the Bug

Following this guide https://developers.cloudflare.com/pages/framework-guides/deploy-an-astro-site/ and then adding Vue and Tailwind I get this error when deploying the site (see attachment). Here's the repo https://github.com/kalepail/astro-vue-cf-app

tl;dr error

Error: Failed to publish your Function. Got error: Uncaught Error: No such module "@vue/server-renderer".
  imported from "renderers.mjs"

What's the expected result?

The site should deploy successfully with the Vue Island

Link to Minimal Reproducible Example

https://github.com/kalepail/astro-vue-cf-app

Participation

kalepail commented 3 months ago

Full error log from CF Pages

2024-03-29T00:58:37.785219Z Cloning repository...
2024-03-29T00:58:38.503559Z From https://github.com/kalepail/astro-vue-cf-app
2024-03-29T00:58:38.50402Z   * branch            44dddbb472efcbf1418e5066a274ef5cef02477c -> FETCH_HEAD
2024-03-29T00:58:38.504166Z 
2024-03-29T00:58:38.532558Z HEAD is now at 44dddbb add tailwind and vue
2024-03-29T00:58:38.532978Z 
2024-03-29T00:58:38.618103Z 
2024-03-29T00:58:38.618587Z Using v2 root directory strategy
2024-03-29T00:58:38.644944Z Success: Finished cloning repository files
2024-03-29T00:58:40.617787Z Invalid wrangler.toml config file detected. Have you included `pages_build_output_dir`? Continuing without reading wrangler.toml
2024-03-29T00:58:40.685724Z Detected the following tools from environment: npm@9.6.7, nodejs@18.17.1
2024-03-29T00:58:40.686513Z Installing project dependencies: npm install --progress=false
2024-03-29T00:58:55.726088Z npm WARN deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead
2024-03-29T00:58:55.759195Z npm WARN deprecated rollup-plugin-inject@3.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-inject.
2024-03-29T00:59:03.480035Z 
2024-03-29T00:59:03.480245Z added 657 packages, and audited 658 packages in 22s
2024-03-29T00:59:03.480498Z 
2024-03-29T00:59:03.480625Z 206 packages are looking for funding
2024-03-29T00:59:03.48071Z    run `npm fund` for details
2024-03-29T00:59:03.482226Z 
2024-03-29T00:59:03.482401Z found 0 vulnerabilities
2024-03-29T00:59:03.510201Z Executing user command: npm run build
2024-03-29T00:59:04.066684Z 
2024-03-29T00:59:04.066976Z > astro-vue-cf-app@0.0.1 build
2024-03-29T00:59:04.0671Z   > astro check && astro build
2024-03-29T00:59:04.067249Z 
2024-03-29T00:59:06.310498Z 24:59:06 [WARN] [@astrojs/cloudflare] The current configuration does not support image optimization. To allow your project to build with the original, unoptimized images, the image service has been automatically switched to the 'noop' option. See https://docs.astro.build/en/reference/configuration-reference/#imageservice
2024-03-29T00:59:06.399113Z 24:59:06 Types generated 88ms
2024-03-29T00:59:06.410371Z 24:59:06 [check] Getting diagnostics for Astro files in /opt/buildhome/repo...
2024-03-29T00:59:08.781697Z Result (6 files): 
2024-03-29T00:59:08.781958Z - 0 errors
2024-03-29T00:59:08.782109Z - 0 warnings
2024-03-29T00:59:08.782216Z - 0 hints
2024-03-29T00:59:08.782314Z 
2024-03-29T00:59:10.55791Z  24:59:10 [WARN] [@astrojs/cloudflare] The current configuration does not support image optimization. To allow your project to build with the original, unoptimized images, the image service has been automatically switched to the 'noop' option. See https://docs.astro.build/en/reference/configuration-reference/#imageservice
2024-03-29T00:59:10.753189Z 24:59:10 [build] output: "server"
2024-03-29T00:59:10.753501Z 24:59:10 [build] directory: /opt/buildhome/repo/dist/
2024-03-29T00:59:10.753656Z 24:59:10 [build] adapter: @astrojs/cloudflare
2024-03-29T00:59:10.753777Z 24:59:10 [build] Collecting build info...
2024-03-29T00:59:10.754213Z 24:59:10 [build] ✓ Completed in 230ms.
2024-03-29T00:59:10.755909Z 24:59:10 [build] Building server entrypoints...
2024-03-29T00:59:13.27254Z  24:59:13 [vite] ✓ built in 2.48s
2024-03-29T00:59:13.272878Z 24:59:13 [build] ✓ Completed in 2.52s.
2024-03-29T00:59:13.273284Z 
2024-03-29T00:59:13.273382Z  building client (vite) 
2024-03-29T00:59:13.280731Z 24:59:13 [vite] transforming...
2024-03-29T00:59:13.605342Z 24:59:13 [vite] ✓ 8 modules transformed.
2024-03-29T00:59:13.642562Z 24:59:13 [vite] rendering chunks...
2024-03-29T00:59:13.6448Z   24:59:13 [vite] computing gzip size...
2024-03-29T00:59:13.648588Z 24:59:13 [vite] dist/_astro/client.DQzxDI-v.js  61.01 kB │ gzip: 24.32 kB
2024-03-29T00:59:13.648766Z 24:59:13 [vite] ✓ built in 372ms
2024-03-29T00:59:13.672214Z 24:59:13 
2024-03-29T00:59:13.672456Z  finalizing server assets 
2024-03-29T00:59:13.672607Z 
2024-03-29T00:59:13.672745Z 24:59:13 [build] Rearranging server assets...
2024-03-29T00:59:13.676896Z 24:59:13 [build] Server built in 3.15s
2024-03-29T00:59:13.677058Z 24:59:13 [build] Complete!
2024-03-29T00:59:13.721942Z Finished
2024-03-29T00:59:13.722528Z Found _worker.js in output directory. Uploading.
2024-03-29T00:59:14.67932Z  ▲ [WARNING] Processing ../../../buildhome/repo/wrangler.toml configuration:
2024-03-29T00:59:14.679985Z 
2024-03-29T00:59:14.680316Z     - No environment found in configuration with name "production".
2024-03-29T00:59:14.680418Z       Before using `--env=production` there should be an equivalent environment section in the configuration.
2024-03-29T00:59:14.680594Z   
2024-03-29T00:59:14.680682Z       Consider adding an environment configuration section to the wrangler.toml file:
2024-03-29T00:59:14.680745Z       ```
2024-03-29T00:59:14.680872Z       [env.production]
2024-03-29T00:59:14.680998Z       ```
2024-03-29T00:59:14.681138Z   
2024-03-29T00:59:14.681259Z 
2024-03-29T00:59:14.681421Z 
2024-03-29T00:59:14.681527Z ▲ [WARNING] Your wrangler.toml is not a valid Pages config file
2024-03-29T00:59:14.681646Z 
2024-03-29T00:59:14.681762Z 
2024-03-29T00:59:14.710308Z Attaching additional modules:
2024-03-29T00:59:14.71923Z  ┌──────────────────────────────────────────┬──────┬────────────┐
2024-03-29T00:59:14.71944Z  │ Name                                     │ Type │ Size       │
2024-03-29T00:59:14.719545Z ├──────────────────────────────────────────┼──────┼────────────┤
2024-03-29T00:59:14.719634Z │ _noop-middleware.mjs                     │ esm  │ 0.12 KiB   │
2024-03-29T00:59:14.719802Z ├──────────────────────────────────────────┼──────┼────────────┤
2024-03-29T00:59:14.719901Z │ chunks/astro/assets-service_CWMdiqxX.mjs │ esm  │ 10.73 KiB  │
2024-03-29T00:59:14.720006Z ├──────────────────────────────────────────┼──────┼────────────┤
2024-03-29T00:59:14.720133Z │ chunks/astro_C2c5pyKs.mjs                │ esm  │ 83.18 KiB  │
2024-03-29T00:59:14.720294Z ├──────────────────────────────────────────┼──────┼────────────┤
2024-03-29T00:59:14.720426Z │ chunks/generic_DSBC1fQz.mjs              │ esm  │ 0.18 KiB   │
2024-03-29T00:59:14.72053Z  ├──────────────────────────────────────────┼──────┼────────────┤
2024-03-29T00:59:14.720637Z │ chunks/index_B65lnX16.mjs                │ esm  │ 0.19 KiB   │
2024-03-29T00:59:14.72073Z  ├──────────────────────────────────────────┼──────┼────────────┤
2024-03-29T00:59:14.720831Z │ chunks/pages/generic_DlMmyJ1e.mjs        │ esm  │ 43.41 KiB  │
2024-03-29T00:59:14.720939Z ├──────────────────────────────────────────┼──────┼────────────┤
2024-03-29T00:59:14.72106Z  │ chunks/pages/index_C6d0WByR.mjs          │ esm  │ 240.11 KiB │
2024-03-29T00:59:14.721178Z ├──────────────────────────────────────────┼──────┼────────────┤
2024-03-29T00:59:14.721294Z │ manifest_DHk15fat.mjs                    │ esm  │ 17.28 KiB  │
2024-03-29T00:59:14.721402Z ├──────────────────────────────────────────┼──────┼────────────┤
2024-03-29T00:59:14.721535Z │ renderers.mjs                            │ esm  │ 1.73 KiB   │
2024-03-29T00:59:14.721654Z └──────────────────────────────────────────┴──────┴────────────┘
2024-03-29T00:59:14.78253Z  ✨ Compiled Worker successfully
2024-03-29T00:59:14.832125Z Found _routes.json in output directory. Uploading.
2024-03-29T00:59:14.845293Z Validating asset output directory
2024-03-29T00:59:15.832245Z Deploying your site to Cloudflare's global network...
2024-03-29T00:59:20.181174Z Uploading... (0/3)
2024-03-29T00:59:20.859642Z Uploading... (1/3)
2024-03-29T00:59:20.910981Z Uploading... (2/3)
2024-03-29T00:59:21.222548Z Uploading... (3/3)
2024-03-29T00:59:21.222897Z ✨ Success! Uploaded 3 files (1.58 sec)
2024-03-29T00:59:21.223027Z 
2024-03-29T00:59:21.614576Z ✨ Upload complete!
2024-03-29T00:59:24.330784Z Success: Assets published!
2024-03-29T00:59:26.048474Z Error: Failed to publish your Function. Got error: Uncaught Error: No such module "@vue/server-renderer".
  imported from "renderers.mjs"
kalepail commented 3 months ago

Here's my PR which fixes this https://github.com/withastro/astro/pull/10601

alexanderniebuhr commented 3 months ago

Thanks for reporting, I'll look into this! I think you're fix is the correct approach, I'll need to check with the team if that could side effects and if we could maybe make this change only for the Cloudflare adapter.