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

External redirects break static build #13120

Closed
1 task
philipschm1tt opened this issue Feb 1, 2025 · 0 comments · Fixed by #13133
Closed
1 task

External redirects break static build #13120

philipschm1tt opened this issue Feb 1, 2025 · 0 comments · Fixed by #13133
Assignees
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority) feat: routing Related to Astro routing (scope)

Comments

@philipschm1tt
Copy link

philipschm1tt commented Feb 1, 2025

Astro Info

Astro                    v5.2.3
Node                     v20.12.2
System                   Windows (x64)
Package Manager          pnpm
Output                   static
Adapter                  none
Integrations             none

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

No response

Describe the Bug

Tested with Astro 5.2.0 and 5.2.3: the build of our static site fails because of external redirects with the following errors (verbose):

On build (not dev):

15:27:52 ▶ /mytest
  astro:build Generating: /mytest +1ms
15:27:52   └─ /mytest/index.html  astro:build Generating: /mytest +1ms
  astro:telemetry {
  astro:telemetry   context: {
  astro:telemetry     isGit: true,
  astro:telemetry     anonymousProjectId: '...',
  astro:telemetry     packageManager: 'pnpm',
  astro:telemetry     packageManagerVersion: '9.15.4',
  astro:telemetry     anonymousId: '...',
  astro:telemetry     anonymousSessionId: '...'
  astro:telemetry   },
  astro:telemetry   meta: {
  astro:telemetry     nodeVersion: '20.12.2',
  astro:telemetry     viteVersion: '6.0.3',
  astro:telemetry     astroVersion: '5.2.3',
  astro:telemetry     systemPlatform: 'win32',
  astro:telemetry     systemRelease: '10.0.22631',
  astro:telemetry     systemArchitecture: 'x64',
  astro:telemetry     cpuCount: 12,
  astro:telemetry     cpuModel: 'Intel(R) Xeon(R) E-2186M  CPU @ 2.90GHz',
  astro:telemetry     cpuSpeed: 2904,
  astro:telemetry     memoryInMb: 32549,
  astro:telemetry     isDocker: false,
  astro:telemetry     isTTY: true,
  astro:telemetry     isWSL: false,
  astro:telemetry     isCI: false,
  astro:telemetry     ciName: null
  astro:telemetry   }
  astro:telemetry } +9s
  astro:telemetry [
  astro:telemetry   {
  astro:telemetry     "eventName": "ASTRO_CLI_ERROR",
  astro:telemetry     "payload": {
  astro:telemetry       "name": "TypeError",
  astro:telemetry       "cliCommand": "build",
  astro:telemetry       "isFatal": true,
  astro:telemetry       "anonymousMessageHint": "immutable"
  astro:telemetry     }
  astro:telemetry   }
  astro:telemetry ] +0ms
immutable
  Stack trace:
    at _Headers.set (node:internal/deps/undici/undici:2413:17)
    at async file:///D:/Website/website/node_modules/.pnpm/astro@5.2.3_@types+node@22.13.0_jiti@2.4.2_rollup@4.34.0_typescript@5.7.3_yaml@2.7.0/node_modules/astro/dist/i18n/middleware.js:49:22
    at async RenderContext.render (file:///D:/Website/website/node_modules/.pnpm/astro@5.2.3_@types+node@22.13.0_jiti@2.4.2_rollup@4.34.0_typescript@5.7.3_yaml@2.7.0/node_modules/astro/dist/core/render-context.js:202:22)
    at async generatePathWithLogs (file:///D:/Website/website/node_modules/.pnpm/astro@5.2.3_@types+node@22.13.0_jiti@2.4.2_rollup@4.34.0_typescript@5.7.3_yaml@2.7.0/node_modules/astro/dist/core/build/generate.js:138:21)
    at async generatePages (file:///D:/Website/website/node_modules/.pnpm/astro@5.2.3_@types+node@22.13.0_jiti@2.4.2_rollup@4.34.0_typescript@5.7.3_yaml@2.7.0/node_modules/astro/dist/core/build/generate.js:82:7)
 ELIFECYCLE  Command failed with exit code 1.

I can produce the error with our (slimmed down) defineConfig:

export default defineConfig({
	site: "https://www.mydomain.com",
	trailingSlash: "always",
	i18n: {
		defaultLocale: "de",
		locales: ["de", "en"],
		routing: {
			prefixDefaultLocale: false,
		},
		fallback: {
			en: "de",
		},
	},
	redirects: {
		"/mytest": "https://example.com/about",
	},
});

The external redirect matches the documentation of the new feature.
Without the redirects or with non-external redirects the build work.

What's the expected result?

External redirects don't break my build.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-1n3kqdia?file=astro.config.mjs

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 Feb 1, 2025
@ematipico ematipico added - P4: important Violate documented behavior or significantly impacts performance (priority) feat: routing Related to Astro routing (scope) labels Feb 4, 2025
@ematipico ematipico self-assigned this Feb 4, 2025
@github-actions github-actions bot removed the needs triage Issue needs to be triaged label Feb 4, 2025
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) feat: routing Related to Astro routing (scope)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants