withastro/astro

[5.0 Beta] catchall route matches _image endpoint in Node

Closed this issue · 3 comments

Astro Info

Astro                    v5.0.0-beta.12
Node                     v22.11.0
System                   macOS (arm64)
Package Manager          npm
Output                   server
Adapter                  @astrojs/node
Integrations             @astrojs/tailwind

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

No response

Describe the Bug

We get 404 errors for all remote images on the production build on our servers. Locally everything works fine.
CleanShot 2024-12-03 at 09 56 55 2@2x

This is our image component:

---
import { Image } from 'astro:assets';
const { image, loading, widths, sizes } = Astro.props;

const imageWidths = widths ?? [240, 360, 480, 720, 960, 1440, 1820, 2560, 3840];
const imageSizes = sizes ?? '100vw';
---

{
	image && (image.src || image.url) && (
		<Image
			src={image.src || image.url}
			alt={image.alt ?? ''}
			width={image.width}
			height={image.height}
			class={Astro.props.class}
			widths={imageWidths}
			sizes={imageSizes}
			loading={loading ?? 'lazy'}
		/>
	)
}

this is the astro.config.mjs

import { defineConfig } from 'astro/config';

import node from '@astrojs/node';

import tailwind from '@astrojs/tailwind';

// https://astro.build/config
export default defineConfig({
	output: 'server',

	adapter: node({
		mode: 'standalone',
	}),

	integrations: [
		tailwind({
			nesting: true,
		}),
	],

	image: {
		domains: ['cms.fooo.com', 'cms.fooo.com.ddev.site'],
	},
});

What's the expected result?

All images should be loaded correctly, despite the NODE_ENV mode.

Link to Minimal Reproducible Example

Github Repo

Participation

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

Hello @MathiasGmeiner. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with needs repro will be closed if they have no activity within 3 days.

@ascorbic I've added a repo now

I have a minimal repro here. It's not about remote images, it's routing for catchall routes. They're overriding the _image endpoint in the node adapter

https://github.com/ascorbic/image-routing-bug