Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Telescope throws an error since newest version #1579

Open
NankoPrinzhorn opened this issue Mar 26, 2025 · 4 comments
Open

Telescope throws an error since newest version #1579

NankoPrinzhorn opened this issue Mar 26, 2025 · 4 comments

Comments

@NankoPrinzhorn
Copy link

NankoPrinzhorn commented Mar 26, 2025

App\Providers\TelescopeServiceProvider::App\Providers{closure}(): Argument #1 ($id) must be of type string, null given

Telescope Version

5.6.0

Laravel Version

12.3.0

PHP Version

8.3.19

Database Driver & Version

No response

Description

Since the newest version of Telescope the following error occurs on all pages

{
  "message": "App\\Providers\\TelescopeServiceProvider::App\\Providers\\{closure}(): Argument #1 ($id) must be of type string, null given",
  "exception": "TypeError",
  "file": "/Users/nanko/Documents/API_PORTAL/portal-api/app/Providers/TelescopeServiceProvider.php",
  "line": 28,
  "trace": [
    {
      "function": "App\\Providers\\{closure}",
      "class": "App\\Providers\\TelescopeServiceProvider",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/telescope/src/Avatar.php",
      "line": 57,
      "function": "call_user_func"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/telescope/src/Avatar.php",
      "line": 26,
      "function": "resolve",
      "class": "Laravel\\Telescope\\Avatar",
      "type": "::"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/telescope/src/EntryResult.php",
      "line": 103,
      "function": "url",
      "class": "Laravel\\Telescope\\Avatar",
      "type": "::"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/telescope/src/Http/Controllers/EntryController.php",
      "line": 53,
      "function": "generateAvatar",
      "class": "Laravel\\Telescope\\EntryResult",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/framework/src/Illuminate/Routing/Controller.php",
      "line": 54,
      "function": "show",
      "class": "Laravel\\Telescope\\Http\\Controllers\\EntryController",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php",
      "line": 44,
      "function": "callAction",
      "class": "Illuminate\\Routing\\Controller",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/framework/src/Illuminate/Routing/Route.php",
      "line": 266,
      "function": "dispatch",
      "class": "Illuminate\\Routing\\ControllerDispatcher",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/framework/src/Illuminate/Routing/Route.php",
      "line": 212,
      "function": "runController",
      "class": "Illuminate\\Routing\\Route",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
      "line": 808,
      "function": "run",
      "class": "Illuminate\\Routing\\Route",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
      "line": 170,
      "function": "Illuminate\\Routing\\{closure}",
      "class": "Illuminate\\Routing\\Router",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/telescope/src/Http/Middleware/Authorize.php",
      "line": 18,
      "function": "Illuminate\\Pipeline\\{closure}",
      "class": "Illuminate\\Pipeline\\Pipeline",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
      "line": 209,
      "function": "handle",
      "class": "Laravel\\Telescope\\Http\\Middleware\\Authorize",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/masmerise/livewire-toaster/src/SessionRelay.php",
      "line": 19,
      "function": "Illuminate\\Pipeline\\{closure}",
      "class": "Illuminate\\Pipeline\\Pipeline",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
      "line": 209,
      "function": "handle",
      "class": "Masmerise\\Toaster\\SessionRelay",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/app/Http/Middleware/UpdateLastSeen.php",
      "line": 27,
      "function": "Illuminate\\Pipeline\\{closure}",
      "class": "Illuminate\\Pipeline\\Pipeline",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
      "line": 209,
      "function": "handle",
      "class": "App\\Http\\Middleware\\UpdateLastSeen",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php",
      "line": 51,
      "function": "Illuminate\\Pipeline\\{closure}",
      "class": "Illuminate\\Pipeline\\Pipeline",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
      "line": 209,
      "function": "handle",
      "class": "Illuminate\\Routing\\Middleware\\SubstituteBindings",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php",
      "line": 88,
      "function": "Illuminate\\Pipeline\\{closure}",
      "class": "Illuminate\\Pipeline\\Pipeline",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
      "line": 209,
      "function": "handle",
      "class": "Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php",
      "line": 49,
      "function": "Illuminate\\Pipeline\\{closure}",
      "class": "Illuminate\\Pipeline\\Pipeline",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
      "line": 209,
      "function": "handle",
      "class": "Illuminate\\View\\Middleware\\ShareErrorsFromSession",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php",
      "line": 121,
      "function": "Illuminate\\Pipeline\\{closure}",
      "class": "Illuminate\\Pipeline\\Pipeline",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php",
      "line": 64,
      "function": "handleStatefulRequest",
      "class": "Illuminate\\Session\\Middleware\\StartSession",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
      "line": 209,
      "function": "handle",
      "class": "Illuminate\\Session\\Middleware\\StartSession",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php",
      "line": 37,
      "function": "Illuminate\\Pipeline\\{closure}",
      "class": "Illuminate\\Pipeline\\Pipeline",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
      "line": 209,
      "function": "handle",
      "class": "Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php",
      "line": 75,
      "function": "Illuminate\\Pipeline\\{closure}",
      "class": "Illuminate\\Pipeline\\Pipeline",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
      "line": 209,
      "function": "handle",
      "class": "Illuminate\\Cookie\\Middleware\\EncryptCookies",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
      "line": 127,
      "function": "Illuminate\\Pipeline\\{closure}",
      "class": "Illuminate\\Pipeline\\Pipeline",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
      "line": 807,
      "function": "then",
      "class": "Illuminate\\Pipeline\\Pipeline",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
      "line": 786,
      "function": "runRouteWithinStack",
      "class": "Illuminate\\Routing\\Router",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
      "line": 750,
      "function": "runRoute",
      "class": "Illuminate\\Routing\\Router",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
      "line": 739,
      "function": "dispatchToRoute",
      "class": "Illuminate\\Routing\\Router",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
      "line": 201,
      "function": "dispatch",
      "class": "Illuminate\\Routing\\Router",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
      "line": 170,
      "function": "Illuminate\\Foundation\\Http\\{closure}",
      "class": "Illuminate\\Foundation\\Http\\Kernel",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/livewire/livewire/src/Features/SupportDisablingBackButtonCache/DisableBackButtonCacheMiddleware.php",
      "line": 19,
      "function": "Illuminate\\Pipeline\\{closure}",
      "class": "Illuminate\\Pipeline\\Pipeline",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
      "line": 209,
      "function": "handle",
      "class": "Livewire\\Features\\SupportDisablingBackButtonCache\\DisableBackButtonCacheMiddleware",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php",
      "line": 21,
      "function": "Illuminate\\Pipeline\\{closure}",
      "class": "Illuminate\\Pipeline\\Pipeline",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php",
      "line": 31,
      "function": "handle",
      "class": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
      "line": 209,
      "function": "handle",
      "class": "Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php",
      "line": 21,
      "function": "Illuminate\\Pipeline\\{closure}",
      "class": "Illuminate\\Pipeline\\Pipeline",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php",
      "line": 51,
      "function": "handle",
      "class": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
      "line": 209,
      "function": "handle",
      "class": "Illuminate\\Foundation\\Http\\Middleware\\TrimStrings",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/framework/src/Illuminate/Http/Middleware/ValidatePostSize.php",
      "line": 27,
      "function": "Illuminate\\Pipeline\\{closure}",
      "class": "Illuminate\\Pipeline\\Pipeline",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
      "line": 209,
      "function": "handle",
      "class": "Illuminate\\Http\\Middleware\\ValidatePostSize",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php",
      "line": 110,
      "function": "Illuminate\\Pipeline\\{closure}",
      "class": "Illuminate\\Pipeline\\Pipeline",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
      "line": 209,
      "function": "handle",
      "class": "Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/framework/src/Illuminate/Http/Middleware/HandleCors.php",
      "line": 49,
      "function": "Illuminate\\Pipeline\\{closure}",
      "class": "Illuminate\\Pipeline\\Pipeline",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
      "line": 209,
      "function": "handle",
      "class": "Illuminate\\Http\\Middleware\\HandleCors",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php",
      "line": 58,
      "function": "Illuminate\\Pipeline\\{closure}",
      "class": "Illuminate\\Pipeline\\Pipeline",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
      "line": 209,
      "function": "handle",
      "class": "Illuminate\\Http\\Middleware\\TrustProxies",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
      "line": 127,
      "function": "Illuminate\\Pipeline\\{closure}",
      "class": "Illuminate\\Pipeline\\Pipeline",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
      "line": 176,
      "function": "then",
      "class": "Illuminate\\Pipeline\\Pipeline",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
      "line": 145,
      "function": "sendRequestThroughRouter",
      "class": "Illuminate\\Foundation\\Http\\Kernel",
      "type": "->"
    },
    {
      "file": "/Users/nanko/Documents/API_PORTAL/portal-api/public/index.php",
      "line": 53,
      "function": "handle",
      "class": "Illuminate\\Foundation\\Http\\Kernel",
      "type": "->"
    },
    {
      "file": "/Users/nanko/.composer/vendor/laravel/valet/server.php",
      "line": 110,
      "function": "require"
    }
  ]
}

Steps To Reproduce

No steps for reproducing, when downgrading to version 5.5.1 all works as normal again

@NankoPrinzhorn
Copy link
Author

NankoPrinzhorn commented Mar 26, 2025

See below json file of the error

telescope error.json

@NankoPrinzhorn NankoPrinzhorn changed the title Telescope avatar throws an error since newest version Telescope throws an error since newest version Mar 26, 2025
@crynobone
Copy link
Member

Hey there, thanks for reporting this issue.

We'll need more info and/or code to debug this further. Can you please create a repository with the command below, commit the code that reproduces the issue as one separate commit on the main/master branch and share the repository here?

Please make sure that you have the latest version of the Laravel installer in order to run this command. Please also make sure you have both Git & the GitHub CLI tool properly set up.

laravel new bug-report --github="--public"

Do not amend and create a separate commit with your custom changes. After you've posted the repository, we'll try to reproduce the issue.

Thanks!

@NankoPrinzhorn
Copy link
Author

I'll make a project this weekend to reproduce. Thanks

@NankoPrinzhorn
Copy link
Author

NankoPrinzhorn commented Mar 31, 2025

Hi @crynobone, I've done some further investigation...

Creating a fresh project with Telescope installed did not reproduce this issue, so I went deeper into the code.

However, I've identified the cause in our project: we have a custom Telescope::avatar callback that expects an $id and $email, as shown below:

Telescope::avatar(function (string $id, string $email) {
    return User::find($id)->avatarURL;
});

In the latest version (v5.6.0), there is a change in how empty emails are checked. See v5.5.1...5.6.0 in src/Avatar.php. This change allows static::resolve($user) to be triggered on a nullable $user, which in turn calls our custom callback.

As a result, we encountered unexpected behavior where $id was null for certain requests in the Telescope logs. According to the Laravel documentation, the provided $id and $email are supposed to be non-nullable. This error occurs on all pages depending if there is an authenticated users or not

NankoPrinzhorn added a commit to NankoPrinzhorn/telescope-custom-avatar-bug that referenced this issue Apr 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants