inertia-laravel icon indicating copy to clipboard operation
inertia-laravel copied to clipboard

Error Modal not works with `LOG_DEPRECATIONS_CHANNEL`

Open robsontenorio opened this issue 4 years ago • 4 comments

Hi, this is weird.

  • Just put LOG_DEPRECATIONS_CHANNEL=stack on .env and the error modal gets empty.
  • Remove this setting and error modal works.

robsontenorio avatar Dec 03 '21 18:12 robsontenorio

Hey @robsontenorio I added the setting to my .env.

  • PHP 7.4
  • laravel/framework 8.73.1
  • inertiajs/inertia-laravel 0.45
return Inertia::render('Component', [
    'nestedTernaryOperatorsAreDeprecatedInPhp74' => 1 ? 2 : 3 ? 4 : 5,
]);
[2021-12-07 07:58:27] local.WARNING: Unparenthesized `a ? b : c ? d : e` is deprecated. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)` ...

The modal is not shown and the error is logged as deprecation. Everything looks fine for me.

fyi: Inertia triggers the Modal if there's an Non-Inertia-Response. I assume this could be an issue with your webserver or PHP settings. It's difficult to resolve here. You could try to reproduce on a different server/setup.

ajnsn avatar Dec 07 '21 08:12 ajnsn

@ajnsn But you said “ The modal is not shown and the error is logged as deprecation”.

That is exactly the problem :)

For clarifying:

  • Just put LOG_DEPRECATIONS_CHANNEL=stack on .env
  • Force any exception on controller, example: a typo.
  • The error modal will be empty

The error model always should be displayed.

robsontenorio avatar Dec 07 '21 13:12 robsontenorio

Ah, but I also tried that. A typo correctly throws a 500 which is also in the response, making Inertia show the modal. This also happens correctly when the "affected" page is directly accessed. Then the error will be thrown directly, not through Inertia. You can also try to test that.

On the 2nd/following visits, please inspect the network tab of the dev tools of your browser and look at the status code and response.

Hope this helps :)

ajnsn avatar Dec 07 '21 14:12 ajnsn

Hi @robsontenorio,

I've also tried to reproduce this. But, same as @ajnsn reported, it works for me. I can not reproduce the described issue.

  1. Set LOG_DEPRECATIONS_CHANNEL=stack in .env
  2. Cause exception in controller
  3. Revisit page

Result: The inertia error modal with error is shown.

If this is still an issue for you it would be great if you could provide a repo with a minimal reproduction. This will help to have a look at it.

NickSdot avatar Jan 04 '22 09:01 NickSdot

Hey there,

We're closing this issue because it's inactive, already solved, old or not relevant anymore. Feel free to open up a new issue if you're still experiencing this problem.

jessarcher avatar Sep 08 '23 01:09 jessarcher