Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New build error - Astro 4.13.4 #11700

Closed
1 task
MeirJC opened this issue Aug 14, 2024 · 9 comments · Fixed by #11709
Closed
1 task

New build error - Astro 4.13.4 #11700

MeirJC opened this issue Aug 14, 2024 · 9 comments · Fixed by #11709
Assignees
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority) regression

Comments

@MeirJC
Copy link

MeirJC commented Aug 14, 2024

Astro Info

> astro "info"

Astro                    v4.13.4
Node                     v20.16.0
System                   macOS (arm64)
Package Manager          pnpm
Output                   server
Adapter                  @astrojs/netlify
Integrations             @astrojs/tailwind
                         @astrojs/svelte

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

cli - In build process

Describe the Bug

New build error - Astro 4.13.4

I have been working on the project daily for the past 2-3 months.
updating the Astro packge and dependencies to the latest versions frequently using the @astrojs/upgrade command.
a few minutes ago, I ran the @astrojs/upgrade command and updated the Astro package from 4.13.3 to version 4.13.4.

After the update, I ran the pnpm build command to build the project, but it failed. which is unusual because the build process has been working fine whenever I update the Astro package.

Main tech stack

  • Astro 4.13.4

  • Svelte 4.2.18

  • TypeScript 5.5.4

  • TailwindCSS 3.4.10

  • Directus SDK 17.0.0

  • Nanostores 0.11.2

  • The deployment adapter is @astrojs/netlify - this is a project i build in my company - and for now we uesd Netlify for dev deployment and doing qa.

Complete process

  1. Update Astro using the @astrojs/upgrade
# pnpm dlx @astrojs/upgrade

 astro   Integration upgrade in progress.

      ◼  @astrojs/check is up to date on v0.9.2
      ◼  @astrojs/netlify is up to date on v5.5.0
      ◼  @astrojs/svelte is up to date on v5.7.0
      ◼  @astrojs/tailwind is up to date on v5.1.0
      ◼  @astrojs/ts-plugin is up to date on v1.9.2
      ●  astro will be updated to v4.13.4

 ██████  Installing dependencies with pnpm...

╭─────╮  Houston:
│ ◠ ◡ ◠  Good luck out there.
╰─────╯
  1. Ran pnpm install just to be sure all dependencies installed correctly.
❯ pnpm install

Lockfile is up to date, resolution step is skipped
Already up to date
Done in 640ms
  1. Ran pnpm astro check to check for TypeScript errors.
❯ pnpm astro check

> @0.0.1 astro /Users/meirjc/Projects/XXXXXXX/XXXXXXXXX
> astro "check"

12:02:14 [types] Generated 158ms
12:02:14 [check] Getting diagnostics for Astro files in /Users/meirjc/Projects/XXXXXXX/XXXXXXXXX...
Result (106 files):
- 0 errors
- 0 warnings
- 0 hints
  1. Ran pnpm build to build the project.

(this is a long process, so I'm not including the full output here - just the error message and the last few lines of the output)

❯ pnpm build

> @0.0.1 build /Users/meirjc/Projects/XXXXXXX/XXXXXXXXX
> astro check && astro build

12:04:35 [types] Generated 151ms
12:04:35 [check] Getting diagnostics for Astro files in /Users/meirjc/Projects/XXXXXXX/XXXXXXXXX...
Result (106 files):
- 0 errors
- 0 warnings
- 0 hints

12:04:40 [WARN] [config] The feature "assets" is experimental and subject to change (used by @astrojs/netlify).
12:04:40 [WARN] [config] The feature "astro:env getSecret" is experimental and subject to change (used by @astrojs/netlify).
12:04:40 [types] Generated 144ms
12:04:40 [build] output: "server"
12:04:40 [build] directory: /Users/meirjc/Projects/XXXXXXX/XXXXXXXXX/dist/
12:04:40 [build] adapter: @astrojs/netlify
12:04:40 [build] Collecting build info...
12:04:40 [build] ✓ Completed in 169ms.
12:04:40 [build] Building server entrypoints...
12:04:40 [ERROR] [vite] x Build failed in 9ms
Entry module "@astrojs/netlify/ssr-function.js" cannot be external.
  Stack trace:
    at getRollupError (file:///Users/meirjc/Projects/XXXXXXX/XXXXXXXXX/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/parseAst.js:392:41)
    at ModuleLoader.loadEntryModule (file:///Users/meirjc/Projects/XXXXXXX/XXXXXXXXX/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:19240:20)
 ELIFECYCLE  Command failed with exit code 1.

These are just the error lines

12:04:40 [ERROR] [vite] x Build failed in 9ms
Entry module "@astrojs/netlify/ssr-function.js" cannot be external.
  Stack trace:
    at getRollupError (file:///Users/meirjc/Projects/XXXXXXX/XXXXXXXXX/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/parseAst.js:392:41)
    at ModuleLoader.loadEntryModule (file:///Users/meirjc/Projects/XXXXXXX/XXXXXXXXX/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:19240:20)
 ELIFECYCLE  Command failed with exit code 1.

These are all the dependencies frmo the package.json

  "dependencies": {
    "@astrojs/check": "^0.9.2",
    "@astrojs/netlify": "^5.5.0",
    "@astrojs/svelte": "^5.7.0",
    "@astrojs/tailwind": "^5.1.0",
    "@astrojs/ts-plugin": "^1.9.2",
    "@directus/sdk": "^17.0.0",
    "@nanostores/persistent": "^0.10.2",
    "astro": "^4.13.4",
    "blaze-slider": "^1.9.3",
    "nanostores": "^0.11.2",
    "svelte": "^4.2.18",
    "tailwind-merge": "^2.5.2",
    "tailwindcss": "^3.4.10",
    "typescript": "^5.5.4",
    "zod": "^3.23.8"
  },
  "devDependencies": {
    "@tailwindcss/typography": "^0.5.14",
    "prettier": "^3.3.3",
    "prettier-plugin-astro": "^0.14.1",
    "prettier-plugin-svelte": "^3.2.6",
    "prettier-plugin-tailwindcss": "^0.6.6"
  },

astro.config.mjs file

import { defineConfig } from "astro/config";
import tailwind from "@astrojs/tailwind";
import svelte from "@astrojs/svelte";
import netlify from "@astrojs/netlify";

// https://astro.build/config
export default defineConfig({
  integrations: [tailwind(), svelte()],
  output: "server",
  adapter: netlify()
});

I have been working on this projects for few, and I have never encountered this error before.
just this update from 4.13.3 to 4.13.4.

What's the expected result?

the build to work as before updating to Astro 4.13.4

Link to Minimal Reproducible Example

https://github.com/MeirJC/demo-error-astro-4.13.4

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Aug 14, 2024
@bluwy
Copy link
Member

bluwy commented Aug 14, 2024

The fail seem to start from #11535 onwards, but I'm not sure what specifically is causing it.

@bluwy bluwy added - P4: important Violate documented behavior or significantly impacts performance (priority) regression and removed needs triage Issue needs to be triaged labels Aug 14, 2024
@ematipico ematipico self-assigned this Aug 14, 2024
@MeirJC
Copy link
Author

MeirJC commented Aug 14, 2024

Never came across this one. started this company project on june 20th with astro 4.10.3 and kept updattin with the astro/update tool often.

reverted back to commit from yesterday and all came back to work properly. no change in any of the components/code/structures/configs were made. just updating the packages.

After comparing the dependencies from yesterday to today, here are the all the changes:

  • astro: ^4.13.3 -> ^4.13.4
  • @astrojs/ts-plugin: ^1.9.1 -> ^1.9.2
  • tailwindcss: ^3.4.9 -> ^3.4.10

@ematipico
Copy link
Member

ematipico commented Aug 14, 2024

Hey @MeirJC, could you use the preview release astro@experimental--server-island-regression, and see if this fixes the issue?

The fix isn't related to server islands, but the regression was introduced from a PR that involves server islands

@MeirJC
Copy link
Author

MeirJC commented Aug 14, 2024

I'll be happy to try this on the full project, i can test it in 20-30 minutes when ill get back to my desk
can you just tell me how can i get it/set it?
(using the official releases)

@ematipico
Copy link
Member

Just run pnpm i astro@experimental--server-island-regression and then build/deploy the website :)

@MeirJC
Copy link
Author

MeirJC commented Aug 14, 2024

Will test and update soon

@ascorbic
Copy link
Contributor

@ematipico I get the same error with @MeirJC 's repo with the preview release

@MeirJC
Copy link
Author

MeirJC commented Aug 14, 2024

Hey @ematipico
Here is some updates:

  • installed the astro@experimental--server-island-regression
    astro ver in package.json: "astro": "0.0.0-server-island-regression-20240814104839"
    build is was still failing
13:22:17 [ERROR] [vite] x Build failed in 9ms
Entry module "@astrojs/netlify/ssr-function.js" cannot be external.
  Stack trace:
    at getRollupError (file:///Users/meirjc/Projects/XXXX/XXXXX/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/parseAst.js:392:41)
    at ModuleLoader.loadEntryModule (file:///Users/meirjc/Projects/XXXXX/XXXXXXX/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:19240:20)
 ELIFECYCLE  Command failed with exit code 1.

  • added to astro config:
experimental: {
    serverIslands: true
  }

build was still failing

  • replaced the adapter from netlify to node (and installed "pnpm add @astrojs/node") and replaced adapter: netlify() with adapter: node({ mode: "standalone" })

Build works with no issues.

Did not tested deploy since this project is deployed to netlify, so it needs the netlify adapter for ssr.

@eryon
Copy link

eryon commented Aug 16, 2024

On a brand new 4.14.2 project without typescript (answered JS-only in the CLI wizard), the zod-to-ts error is present. The pre-release build from #11700 (comment) resolves it. Just mentioning this here to hopefully get a .3 release soon :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority) regression
Projects
None yet
5 participants