Laravel-Backpack / devtools-issues

Bug reports and feature requests for our closed-source DevTools package
4 stars 1 forks source link

[Bug] Add Modal does not work. #59

Closed losmicar closed 1 year ago

losmicar commented 1 year ago

Bug report

What I did

composer create-project laravel/laravel brid composer config http-basic.backpackforlaravel.com user pass added repo to composer.json composer require backpack/crud php artisan backpack:install Installed all 3 premium addons (Backpack pro, DevTools, Backpack Editable Columns) There were no error during the install process.

Licence I bought: Everything.

What I expected to happen

Login is working and DevTools listing is working displaying only Users model as expected. But when I click on Add Model app breaks.

What happened

An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1 near "(": syntax error https://capture.dropbox.com/mTOkDFg5Sd8cOVLO

What I've already tried to fix it

composer require --dev --with-all-dependencies backpack/devtools composer update backpack/crud

Backpack, Laravel, PHP, DB version

PHP 8.1.12 Laravel version: 9.48.0 MySql 8.0 laravel/laravel - requires backpack/crud (^5.4)
backpack/devtools 1.3.0 requires backpack/crud (^5.3)
backpack/editable-columns 2.1.1 requires backpack/crud (^5.3.13) backpack/generators v3.3.13 requires backpack/crud (^5.3.11) backpack/pro 1.6.0 requires backpack/crud (^5.4.9)

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

PHP VERSION:

PHP 8.1.12 (cli) (built: Oct 31 2022 22:06:27) (NTS) Copyright (c) The PHP Group Zend Engine v4.1.12, Copyright (c) Zend Technologies with Zend OPcache v8.1.12, Copyright (c), by Zend Technologies

LARAVEL VERSION:

v9.48.0@c78ae7aeb0cbcb1a205050d3592247ba07f5b711

BACKPACK PACKAGE VERSIONS:

Operating System and Server Setup

I encountered the problem above on my Amazon Linux 2 EC2 instance.

Log

[previous exception] [object] (PDOException(code: HY000): SQLSTATE[HY000]: General error: 1 near \"(\": syntax error at /var/www/brid/vendor/laravel/framework/src/Illuminate/Database/PDO/Connection.php:81) [stacktrace]

0 /var/www/brid/vendor/laravel/framework/src/Illuminate/Database/PDO/Connection.php(81): PDO->query(' SEL...')

1 /var/www/brid/vendor/doctrine/dbal/src/Connection.php(1064): Illuminate\Database\PDO\Connection->query(' SEL...')

2 /var/www/brid/vendor/doctrine/dbal/src/Schema/SqliteSchemaManager.php(703): Doctrine\DBAL\Connection->executeQuery(' SEL...', Array)

3 /var/www/brid/vendor/doctrine/dbal/src/Schema/AbstractSchemaManager.php(561): Doctrine\DBAL\Schema\SqliteSchemaManager->selectTableColumns('main')

4 /var/www/brid/vendor/doctrine/dbal/src/Schema/AbstractSchemaManager.php(408): Doctrine\DBAL\Schema\AbstractSchemaManager->fetchTableColumnsByTable('main')

5 /var/www/brid/vendor/doctrine/dbal/src/Schema/SqliteSchemaManager.php(57): Doctrine\DBAL\Schema\AbstractSchemaManager->doListTables()

6 /var/www/brid/vendor/doctrine/dbal/src/Schema/AbstractSchemaManager.php(1651): Doctrine\DBAL\Schema\SqliteSchemaManager->listTables()

7 /var/www/brid/vendor/backpack/crud/src/app/Library/Database/DatabaseSchema.php(36): Doctrine\DBAL\Schema\AbstractSchemaManager->createSchema()

8 /var/www/brid/vendor/backpack/crud/src/app/Library/Database/DatabaseSchema.php(21): Backpack\CRUD\app\Library\Database\DatabaseSchema::generateDatabaseSchema('Backpack\\DevToo...', 'models')

9 /var/www/brid/vendor/backpack/crud/src/app/Library/Database/TableSchema.php(12): Backpack\CRUD\app\Library\Database\DatabaseSchema::getForTable('Backpack\\DevToo...', 'models')

10 /var/www/brid/vendor/backpack/crud/src/app/Models/Traits/HasRelationshipFields.php(132): Backpack\CRUD\app\Library\Database\TableSchema->__construct('Backpack\\DevToo...', 'models')

11 /var/www/brid/vendor/backpack/crud/src/app/Library/CrudPanel/Traits/AutoSet.php(91): Backpack\DevTools\Models\Model::getDbTableSchema()

12 /var/www/brid/vendor/backpack/crud/src/app/Library/CrudPanel/Traits/AutoSet.php(57): Backpack\CRUD\app\Library\CrudPanel\CrudPanel->getDbTableColumns()

13 /var/www/brid/vendor/backpack/crud/src/app/Library/CrudPanel/Traits/AutoSet.php(116): Backpack\CRUD\app\Library\CrudPanel\CrudPanel->getDbColumnTypes()

14 /var/www/brid/vendor/backpack/crud/src/app/Library/CrudPanel/Traits/FieldsProtectedMethods.php(230): Backpack\CRUD\app\Library\CrudPanel\CrudPanel->inferFieldTypeFromDbColumnType('name')

15 /var/www/brid/vendor/backpack/crud/src/app/Library/CrudPanel/Traits/Fields.php(54): Backpack\CRUD\app\Library\CrudPanel\CrudPanel->makeSureFieldHasType(Array)

16 /var/www/brid/vendor/backpack/crud/src/app/Library/CrudPanel/Traits/Fields.php(108): Backpack\CRUD\app\Library\CrudPanel\CrudPanel->makeSureFieldHasNecessaryAttributes(Array)

17 /var/www/brid/vendor/backpack/crud/src/app/Library/CrudPanel/CrudField.php(375): Backpack\CRUD\app\Library\CrudPanel\CrudPanel->addField(Array)

18 /var/www/brid/vendor/backpack/crud/src/app/Library/CrudPanel/CrudField.php(57): Backpack\CRUD\app\Library\CrudPanel\CrudField->save()

19 /var/www/brid/vendor/backpack/crud/src/app/Library/CrudPanel/Traits/Fields.php(543): Backpack\CRUD\app\Library\CrudPanel\CrudField->__construct('name')

20 /var/www/brid/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(338): Backpack\CRUD\app\Library\CrudPanel\CrudPanel->field('name')

21 /var/www/brid/vendor/backpack/devtools/src/Http/Controllers/ModelCrudController.php(158): Illuminate\Support\Facades\Facade::__callStatic('field', Array)

22 /var/www/brid/vendor/backpack/crud/src/app/Http/Controllers/CrudController.php(121): Backpack\DevTools\Http\Controllers\ModelCrudController->setupCreateOperation()

23 /var/www/brid/vendor/backpack/crud/src/app/Http/Controllers/CrudController.php(42): Backpack\CRUD\app\Http\Controllers\CrudController->setupConfigurationForCurrentOperation()

24 /var/www/brid/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(162): Backpack\CRUD\app\Http\Controllers\CrudController->Backpack\CRUD\app\Http\Controllers\{closure}(Object(Illuminate\Http\Request), Object(Closure))

25 /var/www/brid/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

26 /var/www/brid/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(31): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))

27 /var/www/brid/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull->handle(Object(Illuminate\Http\Request), Object(Closure))

28 /var/www/brid/app/Http/Middleware/CheckIfAdmin.php(66): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

29 /var/www/brid/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): App\Http\Middleware\CheckIfAdmin->handle(Object(Illuminate\Http\Request), Object(Closure))

30 /var/www/brid/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(50): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

31 /var/www/brid/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Routing\Middleware\SubstituteBindings->handle(Object(Illuminate\Http\Request), Object(Closure))

32 /var/www/brid/vendor/backpack/crud/src/app/Http/Middleware/AuthenticateSession.php(62): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

33 /var/www/brid/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Backpack\CRUD\app\Http\Middleware\AuthenticateSession->handle(Object(Illuminate\Http\Request), Object(Closure))

34 /var/www/brid/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(78): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

35 /var/www/brid/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle(Object(Illuminate\Http\Request), Object(Closure))

36 /var/www/brid/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

37 /var/www/brid/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure))

38 /var/www/brid/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(121): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

39 /var/www/brid/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(64): Illuminate\Session\Middleware\StartSession->handleStatefulRequest(Object(Illuminate\Http\Request), Object(Illuminate\Session\Store), Object(Closure))

40 /var/www/brid/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))

41 /var/www/brid/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

42 /var/www/brid/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))

43 /var/www/brid/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(67): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

44 /var/www/brid/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))

45 /var/www/brid/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

46 /var/www/brid/vendor/laravel/framework/src/Illuminate/Routing/Router.php(799): Illuminate\Pipeline\Pipeline->then(Object(Closure))

47 /var/www/brid/vendor/laravel/framework/src/Illuminate/Routing/Router.php(776): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))

48 /var/www/brid/vendor/laravel/framework/src/Illuminate/Routing/Router.php(740): Illuminate\Routing\Router->runRoute(Object(Illuminate\Http\Request), Object(Illuminate\Routing\Route))

49 /var/www/brid/vendor/laravel/framework/src/Illuminate/Routing/Router.php(729): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))

50 /var/www/brid/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(190): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))

51 /var/www/brid/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(141): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))

52 /var/www/brid/vendor/livewire/livewire/src/DisableBrowserCache.php(19): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

53 /var/www/brid/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Livewire\DisableBrowserCache->handle(Object(Illuminate\Http\Request), Object(Closure))

54 /var/www/brid/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

55 /var/www/brid/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(31): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))

56 /var/www/brid/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull->handle(Object(Illuminate\Http\Request), Object(Closure))

57 /var/www/brid/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

58 /var/www/brid/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(40): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))

59 /var/www/brid/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Foundation\Http\Middleware\TrimStrings->handle(Object(Illuminate\Http\Request), Object(Closure))

60 /var/www/brid/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

61 /var/www/brid/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle(Object(Illuminate\Http\Request), Object(Closure))

62 /var/www/brid/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(86): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

63 /var/www/brid/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance->handle(Object(Illuminate\Http\Request), Object(Closure))

64 /var/www/brid/vendor/laravel/framework/src/Illuminate/Http/Middleware/HandleCors.php(49): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

65 /var/www/brid/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Http\Middleware\HandleCors->handle(Object(Illuminate\Http\Request), Object(Closure))

66 /var/www/brid/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php(39): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

67 /var/www/brid/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Http\Middleware\TrustProxies->handle(Object(Illuminate\Http\Request), Object(Closure))

68 /var/www/brid/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

69 /var/www/brid/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(165): Illuminate\Pipeline\Pipeline->then(Object(Closure))

70 /var/www/brid/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(134): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))

71 /var/www/brid/public/index.php(52): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))

72 {main}

pxpm commented 1 year ago

Hey @losmicar

Thanks for the report.

I've just created a setup like you described, and everything worked for me.

image

It may be due to some server configuration, what version of SQLite are you running on your server ?

My phpinfo() return something like:

SQLite 3.x driver for PDO => Wez Furlong
SQLite3 => Scott MacVicar, Ilia Alshanetsky, Brad Dewar

Cheers

losmicar commented 1 year ago

Hi @pxpm,

Thank you for you reply. Here are the details you've asked for.

SQLite 3.x driver for PDO Wez Furlong
SQLite3 Scott MacVicar, Ilia Alshanetsky, Brad Dewar
pdo_sqlite SQLite Library 3.7.17

Here is the output of the php info. http://losmi555.brid.tv/

Also I can share any access admin dashboard or directly to the server that you need for debugging purpose.

pxpm commented 1 year ago

Thanks @losmicar .

Can you check if this helps: https://github.com/Laravel-Backpack/devtools-issues/issues/58#issuecomment-1405572062

It also seems that your sqlite library is a bit old, I am using 3.37 and the last one release was 3.40, so you may also want to update it, it may have some conflicting code between those versions ?

It is also related with: https://github.com/Laravel-Backpack/devtools-issues/issues/54#issuecomment-1280665967

So I really think that the older version of SQLite is the problem here.

Cheers

losmicar commented 1 year ago

Hi @pxpm

I've upgraded SQLite to 3.9 and needed to compile it with SQLITE_ENABLE_COLUMN_METADATA flag to work.

It looks it is resolved!

pxpm commented 1 year ago

Thanks for getting back with that information @losmicar

We have an open PR that would make the SQLite errors more visible and easier to debug for the developer.

Thanks again 🙏 Cheers