Skip to content

Empty response body when using Blaze with Stancl Tenancy (multi-tenant Livewire MFC components) #177

@erikscheepers

Description

@erikscheepers

When Blaze is enabled in a multi-tenant application using Stancl Tenancy with domain-based identification, all tenant-domain pages return an empty response body. The Blaze debug widget is visible (appended to the empty string), and the debug bar confirms DB queries ran and components were tracked, but no HTML is rendered in the browser.

Disabling Blaze immediately resolves the issue.

Environment:

  • livewire/blaze: v1.0.11
  • livewire/livewire: v4
  • laravel/framework: v13
  • stancl/tenancy: v4 dev-master

Setup:
Blaze is configured in AppServiceProvider:

  Blaze::optimize()
      ->in(resource_path('views/components'))
      ->in(resource_path('views/flux'));

In this multi-tenant setup, Livewire multi-file components (MFC) for the tenant namespace are compiled into tenant-scoped storage paths rather than the global storage/framework/views/livewire/. For example, a component cached at:
storage/tenant_a/framework/views/livewire/classes/7ab33dcb.php
storage/tenant_a/framework/views/livewire/views/7ab33dcb.blade.php

The compiled class references the tenant-scoped view via an absolute path:

  protected function view($data = [])
  {
      return app('view')->file('/path/to/storage/tenant_a/framework/views/livewire/views/7ab33dcb.blade.php', $data);                                                                                                                                                                                                                                                    
  }

Observed behaviour:

  • HTTP 200 response with empty body
  • Blaze debug widget renders (appended to empty string, so it appears at the top of the page)
  • Debug bar shows components were tracked (flux::heading, flux::link, flux::button, layout:components.layouts.tenant)
  • DebuggerMiddleware::injectDebugger() reads $response->getContent() as empty — the rendered HTML is lost before Blaze can inject into it

Expected behaviour:
Full HTML page renders correctly, with the Blaze debug widget injected before .

Workaround:
Disabling Blaze restores correct rendering.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions