withastro/astro · warning
[@astrojs/react] Importing `getContainerRenderer` from `@ast
Error message
[@astrojs/react] Importing `getContainerRenderer` from `@astrojs/react` is deprecated. Import it from `@astrojs/react/container-renderer` instead.
What it means
@astrojs/react keeps a deprecated getContainerRenderer() export on the package root that console.warns and forwards to the real implementation in ./container-renderer. It exists so older manual-SSR setups (experimental_AstroContainer with an Express/Hono server) keep working, but the root export is scheduled for removal in favor of the @astrojs/react/container-renderer subpath.
Source
Thrown at packages/integrations/react/src/index.ts:216
const enabledKnownJsxRenderers = config.integrations.filter((renderer) =>
knownJsxRenderers.includes(renderer.name),
);
if (enabledKnownJsxRenderers.length > 1 && !include && !exclude) {
logger.warn(
'More than one JSX renderer is enabled. This will lead to unexpected behavior unless you set the `include` or `exclude` option. See https://docs.astro.build/en/guides/integrations-guide/react/#combining-multiple-jsx-frameworks for more information.',
);
}
},
},
};
}
/**
* @deprecated Import `getContainerRenderer` from `@astrojs/react/container-renderer` instead.
*/
export function getContainerRenderer(): AstroRenderer {
console.warn(
'[@astrojs/react] Importing `getContainerRenderer` from `@astrojs/react` is deprecated. Import it from `@astrojs/react/container-renderer` instead.',
);
return getContainerRendererImpl();
}
View on GitHub (pinned to 52e6c34790)
Solutions
- Import from the subpath: import { getContainerRenderer } from '@astrojs/react/container-renderer';
- Grep the repo for from '@astrojs/react' destructuring getContainerRenderer and update every occurrence.
- Re-run the server; the warning should not print again.
Example fix
// before
import { getContainerRenderer } from '@astrojs/react';
Container.addRenderer({ name: 'react', serverEntrypoint: await getContainerRenderer() });
// after
import { getContainerRenderer } from '@astrojs/react/container-renderer';
Container.addRenderer({ name: 'react', serverEntrypoint: await getContainerRenderer() }); Defensive patterns
Strategy: validation
Validate before calling
const src = await readFile('server.ts', 'utf8');
if (src.includes("{ getContainerRenderer } from '@astrojs/react'")) {
throw new Error("Import getContainerRenderer from '@astrojs/react/container-renderer'");
} Prevention
- Import container renderers from the /container-renderer subpath only.
- Use no-restricted-imports lint rules to block the root-path named import.
- Upgrade custom SSR servers in lockstep with @astrojs/react major versions.
When it happens
Trigger: Server code imports { getContainerRenderer } from '@astrojs/react' (root entry) to register the renderer on an AstroContainer instance, e.g. container.addRenderer({ name: 'react', serverEntrypoint: await getContainerRenderer() }).
Common situations: Upgrading @astrojs/react after container APIs moved to a subpath; copying older custom SSR server examples; NestJS/Hono integrations written against the previous export surface.
Related errors
- [@astrojs/preact] Importing `getContainerRenderer` from `@as
- [@astrojs/solid-js] Importing `getContainerRenderer` from `@
- [@astrojs/svelte] Importing `getContainerRenderer` from `@as
- The @astrojs/netlify/functions import is deprecated and will
- The @astrojs/netlify/static import is deprecated and will be
AI-assisted analysis of withastro/astro@52e6c34790 (2026-08-18).
Data as JSON: /api/errors/9cfcde572a0b0be2.
Report an issue: GitHub.