Skip to content

Local static build exits 0 and builds nothing when the Tina datalayer is unreachable #749

Description

@jamiefolsom

Running astro build with STATIC_BUILD=true outside of tinacms dev (and without a reachable MongoDB) produces no pages, no error, and exit code 0. The log ends mid-build, right after a content loader starts:

11:20:47 [content] Syncing content
11:20:47 [i18n-loader] Fetching data.
(process exits 0)

What happens: the loaders query TinaCMS through @tina/databaseClient, which talks to the datalayer directly. With no datalayer available the query never settles, node runs out of pending work, and the process exits cleanly in the middle of the await. In a script or CI job this looks like a successful build unless something inspects dist/.

The build should fail loudly when the datalayer can't be reached — a connection timeout or an upfront reachability check in the loaders would both do it.

Workaround for local static builds: run the build inside the datalayer, TINA_PUBLIC_IS_LOCAL=true tinacms dev -c "astro build". (On Netlify this doesn't bite because MongoDB is reachable at build time.)

Found while running a static build of marronage staging locally (dhtools performant-software/dhtools#17).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions