Laravel-Backpack / CRUD

Build custom admin panels. Fast!
https://backpackforlaravel.com
MIT License
3k stars 880 forks source link

[Bug] [Feature] Improve error message when table has not been migrated #5528

Closed Kasparsu closed 1 month ago

Kasparsu commented 1 month ago

Bug report

What I did

Open newly created crud while forgetting to migrate the table it was generated on

What I expected to happen

Nice error message telling me that hey we did not find table this crud was generated for maybe you forgot to migrate

What happened

nondescript and super unhelpful stacktrace image

What I've already tried to fix it

Migrated the table.

Is it a bug in the latest version of Backpack?

After I run composer update backpack/crud the bug... is it still there? yes

Backpack, Laravel, PHP, DB version

When I run php artisan backpack:version the output is:

PHP VERSION:

8.2.4

PHP EXTENSIONS:

Core, bcmath, calendar, ctype, date, filter, hash, iconv, json, SPL, pcre, random, readline, Reflection, session, standard, mysqlnd, tokenizer, zlib, libxml, dom, PDO, openssl, SimpleXML, xml, xmlreader, xmlwriter, curl, fileinfo, mbstring, Phar, pdo_mysql, pdo_sqlite

LARAVEL VERSION:

11.9.1.0

BACKPACK PACKAGE VERSIONS:

backpack/basset: 1.3.4 backpack/crud: 6.7.14 backpack/generators: v4.0.5 backpack/theme-tabler: 1.2.10

welcome[bot] commented 1 month ago

Hello there! Thanks for opening your first issue on this repo!

Just a heads-up: Here at Backpack we use Github Issues only for tracking bugs. Talk about new features is also acceptable. This helps a lot in keeping our focus on improving Backpack. If you issue is not a bug/feature, please help us out by closing the issue yourself and posting in the appropriate medium (see below). If you're not sure where it fits, it's ok, a community member will probably reply to help you with that.

Backpack communication channels:

Please keep in mind Backpack offers no official / paid support. Whatever help you receive here, on Gitter, Slack or Stackoverflow is thanks to our awesome awesome community members, who give up some of their time to help their peers. If you want to join our community, just start pitching in. We take pride in being a welcoming bunch.

Thank you!

-- Justin Case The Backpack Robot

Kasparsu commented 1 month ago

Seems this is a bug after all. Nice Backpack exceptions are giving this nondescript error because laravel 11.x is not happy about how routes are registered by Backpack.

Kasparsu commented 1 month ago

And it seems to be that Exceptions not rendering correctly was laravel issue https://github.com/laravel/framework/pull/51614 when fix is applied exception when table hasn't been migrated is much more reasonable image

This issue can be closed when laravel v11.9.2 is released 11.10.0

pxpm commented 1 month ago

Thanks @Kasparsu for the report and for gathering all the info 🙏

I started reading your issue report without noticing your further replies and I was thinking to myself that this should be an issue in Laravel, we don't do any magic tricks to the exception, since it's from an "ajax call", the search endpoint, we render it nicely in an iframe, or the error would be hidden in the browser network tab and not visible for the developer.

Nice find about the Laravel issue. 🙏

I will keep this open until Laravel releases the fixed version.

Thanks again! 🙏

Kasparsu commented 1 month ago

Laravel 11.9.2 has been released including the fix mentioned above making this issue solved. Closing