Skip to content

CLI, Testing & Troubleshooting

Inertia ships three trk/processwire-console CLI commands, a dedicated Pest/PHPUnit assertion helper, and a TracyDebugger protocol panel.

All commands run via php vendor/bin/wire <command> and support --json for machine-readable output and --dry-run for safe previews.

Publishes _inertia.php, site/templates/assets/js/inertia.ts, a starter SPA page component, Custom Page Classes, and inertia.d.ts, and enables the target template in Inertia.

Terminal window
php vendor/bin/wire inertia:install --stack=react --template=inertia
Option Short Default Description
--stack -s vue Frontend stack to scaffold: vue, react, or svelte.
--template -t inertia ProcessWire template to enable and scaffold.
--dry-run false Preview planned file and configuration changes without writing to disk.
--force -f false Overwrite existing starter files.
--json false Output results as structured JSON.

Generates strongly typed PHP Custom Page Classes (site/classes/*Page.php) and TypeScript definitions (inertia.d.ts) from your ProcessWire templates, fields, and DataProviders.

Terminal window
php vendor/bin/wire inertia:types --template=article,home --ts-only
Option Short Default Description
--template -t all enabled Target template name(s), comma-separated or repeated.
--output -o config path Custom output path for inertia.d.ts (must be a non-symlinked .ts file inside site/ or system temp).
--ts-only false Generate only TypeScript (.d.ts) definitions. Cannot be combined with --php-only.
--php-only false Generate only PHP Custom Page Classes. Cannot be combined with --ts-only.
--controllers -c false Also scaffold missing site/templates/{template}.php controllers.
--dry-run false Preview generated classes and TypeScript output without writing to disk.
--force -f false Overwrite existing PHP Custom Page Classes and template controllers.
--json false Output results as structured JSON.

Checks health, starts, or stops the local Node or Bun Server-Side Rendering process.

Terminal window
php vendor/bin/wire inertia:ssr status --json
php vendor/bin/wire inertia:ssr start --runtime=node --bundle=site/templates/assets/dist/ssr/ssr.mjs
php vendor/bin/wire inertia:ssr stop --force
Argument / Option Short Default Description
action (argument) status Action to perform: status, start, or stop.
--runtime -r node JavaScript runtime binary: node or bun.
--bundle -b auto-detect Path to compiled SSR bundle inside site/ (.js, .mjs, or .cjs).
--url -u config ssrUrl Override SSR server URL (must pass loopback/allowlist policy).
--dry-run false Preview planned SSR action without spawning or stopping processes.
--force -f false Skip confirmation prompt for stop in non-interactive or --json mode.
--json false Output results as structured JSON.

Test Inertia responses in Pest or PHPUnit without spinning up a browser by calling $pageResponse->assert() or constructing Totoglu\Inertia\Testing\AssertableInertia from HTML or JSON output:

<?php
declare(strict_types=1);
namespace ProcessWire;
use Totoglu\Inertia\Testing\AssertableInertia;
$page = wire()->pages->get('template=article');
$response = inertia()->render('Articles/Show', [
'page' => $page,
'featured' => true,
]);
$response->assert()
->component('Articles/Show')
->where('featured', true)
->has('page.title')
->etc();
// Or inspect rendered HTML / JSON strings directly
$fromHtml = AssertableInertia::fromHtml($response->render());
$fromHtml->component('Articles/Show')->has('page.id')->etc();

When tracySupport is enabled and $config->debug is true, Inertia registers InertiaTracyPanel inside TracyDebugger. Open the panel to inspect:

  • Active component name, URL, and Vite asset version hash
  • Full serialized props payload, deferred groups, and OnceProp cache keys
  • SSR gateway latency, status, or CSR fallback reason

Classic _main.php layout wraps my Inertia output

Section titled “Classic _main.php layout wraps my Inertia output”

Confirm that Disable $config->appendTemplateFile (_main.php) on Inertia Templates (disableAppendTemplateFile) is checked under Modules > Configure > Inertia and that your template is listed in Inertia Templates (or Full SPA Mode is enabled).

Infinite reload loop on SPA navigation (409 Conflict)

Section titled “Infinite reload loop on SPA navigation (409 Conflict)”

A 409 reload loop happens when the asset version hash changes on every request. Verify that Vite has a built manifest file in production or is running its dev server cleanly in development, or check any custom $inertia->version(...) callback for non-deterministic values.

CSRF validation fails on useForm() POST requests

Section titled “CSRF validation fails on useForm() POST requests”

Ensure Auto-Share CSRF Token & XSRF-TOKEN Cookie (autoShareCsrf) and Synchronize JSON Request Body to $input->post (syncJsonToPost) are both enabled. If you submit requests from a custom fetch client instead of Inertia’s useForm() or router, send the X-XSRF-TOKEN header or include the props.csrf name/value pair in the request body.

TypeScript types are out of date after adding a ProcessWire field

Section titled “TypeScript types are out of date after adding a ProcessWire field”

Run php vendor/bin/wire inertia:types --ts-only to regenerate inertia.d.ts. Automatic regeneration runs on template and field saves only when $config->debug is true and autoGenerateTypes is enabled.

SSR Fallback Diagnostics (inertia-ssr Log) & Localization

Section titled “SSR Fallback Diagnostics (inertia-ssr Log) & Localization”
  • Log channel (inertia-ssr): Whenever Server-Side Rendering fails or falls back to client-side rendering, Inertia writes a structured diagnostic entry to Setup -> Logs -> inertia-ssr.
  • 6-Locale Translation Packs: Bundled CSV packs (en, tr, de, fr, es, ru) live in site/modules/Inertia/languages/ for import under Setup -> Languages -> [Language] -> Site Translation Files.

Next steps