#Container API and i18n

2 messages · Page 1 of 1 (latest)

mystic fractal
#

Hello, so i'm trying to basically render a page through container API with i18n enabled and with a [...lang] param:

export async function GET({ params, props }: APIContext) {
    const { post } = props as Props;
    const { lang } = params as Params;

    if (!lang) {
        return new Response(null, { status: 404 });
    }

    const container = await experimental_AstroContainer.create();
    return await container.renderToResponse(FileToRender, {
        routeType: "page",
        partial: false,
        props: { post: post },
        params: {
            lang: "en",
            slug: getBlogPostSlug("en", post),
        },
    });

    //return new Response(content, { status: 200 });
}

the structure is: pages/[...lang]/blog/posts/[...slug]/FileToRender.astro

However i'm getting this error:

11:26:22 [ERROR] [MissingLocaleError] The locale/path `undefined` does not exist in the configured `i18n.locales`.
  Stack trace:
    at getLocaleRelativeUrl 
...

Am i doing something wrong or this is not actually supported?

grizzled tundra
#

Hi! Can you post the contents of the component?