Skip to content

Call to a member function getDomain() on null #7

@sebastiaanluca

Description

@sebastiaanluca

When someone tries to access a file that doesn't exist in our app (.e.g https://app.test/build/assets/main-DXQ67tRB.css) and it returns a 404, an exception is logged:

Error /public/index.php in ?

Call to a member function getDomain() on null

/vendor/laravel/pulse/src/Recorders/Concerns/LivewireRoutes.php in TiMacDonald\Pulse\Recorders\ValidationErrors::resolveRoutePath at line 20

     */
    protected function resolveRoutePath(Request $request): array
    {
        /** @var Route */
        $route = $request->route();
        $path = $route->getDomain().Str::start($route->uri(), '/');
        $via = $route->getActionName();
        if ($route->named('*livewire.update')) {
            $snapshot = json_decode($request->input('components.0.snapshot'), flags: JSON_THROW_ON_ERROR);

Screenshot 2024-05-15 at 10 49 07

resolveRoutePath is executed before shouldIgnore so we can't ignore it, but don't know if that would work either since it's not a route but a path to a resource. Should it return early in the closure and halt execution if route is null?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions