Error 500 when add new field

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • PGI
    Member
    • Oct 2017
    • 77

    Error 500 when add new field

    Hello,

    When I add a new field to an entity, I get an error 500 (see attachment). Could you help me, please?

    In the logs, I don't see anything...

    Thank you.

    My EspoCRM : v5.5.6
  • Maximus
    Senior Member
    • Nov 2018
    • 2731

    #2
    Hello,
    please check the server log? This can help you to find the log file https://www.espocrm.com/documentatio...ent-check-logs

    Comment

    • PGI
      Member
      • Oct 2017
      • 77

      #3
      Hello,
      Thank you, but the logs are empty.
      However, I notice that the problem exists for adding fields to leads but not for other entities.
      Does anyone have any ideas?

      Comment

      • Maximus
        Senior Member
        • Nov 2018
        • 2731

        #4
        Hello,
        It seems the problem with access. Configure one more time your permission settings. https://www.espocrm.com/documentatio...-based-systems

        Comment

        • PGI
          Member
          • Oct 2017
          • 77

          #5
          Hello,

          I checked the rights, everything's okay.

          I found logs, but I don't understand where the problem is coming from. Every time I added fields to my leads entity, I always did it through the graphical interface, I never modified the files or the database.

          I encounter this problem when I add a varchar field to leads. I tried with a checkbox field and it works even if I get a 400 error message that appears for a second (but it doesn't really block).

          Do you have any ideas to help me?

          Thank you!

          LOGS :

          Code:
          [2019-04-16 17:15:08] Espo.ALERT: Rebuild database fault: PDOException: SQLSTATE[42000]: Syntax error or access violation: 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. You have to change some columns to TEXT or BLOBs in /var/www/vhosts/domain.tld/iris.domain.tld/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:699 Stack trace: #0 /var/www/vhosts/domain.tld/iris.domain.tld/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(699): PDO->query('ALTER TABLE `le...') #1 /var/www/vhosts/domain.tld/iris.domain.tld/application/Espo/Core/Utils/Database/Schema/Schema.php(196): Doctrine\DBAL\Connection->executeQuery('ALTER TABLE `le...') #2 /var/www/vhosts/domain.tld/iris.domain.tld/application/Espo/Core/DataManager.php(95): Espo\Core\Utils\Database\Schema\Schema->rebuild('Lead') #3 /var/www/vhosts/domain.tld/iris.domain.tld/application/Espo/Core/DataManager.php(62): Espo\Core\DataManager->rebuildDatabase('Lead') #4 /var/www/vhosts/domain.tld/iris.domain.tld/application/Espo/Controllers/FieldManager.php(71): Espo\Core\DataManager->rebuild('Lead') #5 /var/www/vhosts/domain.tld/iris.domain.tld/application/Espo/Core/ControllerManager.php(143): Espo\Controllers\FieldManager->postActionCreate(Array, Object(stdClass), Object(Slim\Http\Request), Object(Slim\Http\Response)) #6 /var/www/vhosts/domain.tld/iris.domain.tld/application/Espo/Core/ControllerManager.php(159): Espo\Core\ControllerManager->processRequest(Object(Espo\Controllers\FieldManager), 'create', Array, Object(stdClass), Object(Slim\Http\Request), Object(Slim\Http\Response)) #7 /var/www/vhosts/domain.tld/iris.domain.tld/application/Espo/Core/Application.php(296): Espo\Core\ControllerManager->process('FieldManager', 'create', Array, '{"type":"varcha...', Object(Slim\Http\Request), Object(Slim\Http\Response)) #8 [internal function]: Espo\Core\Application->Espo\Core\{closure}() #9 /var/www/vhosts/domain.tld/iris.domain.tld/vendor/slim/slim/Slim/Slim.php(1210): call_user_func_array(Object(Closure), Array) #10 /var/www/vhosts/domain.tld/iris.domain.tld/vendor/slim/slim/Slim/Slim.php(1356): Slim\Slim->applyHook('slim.before.dis...') #11 /var/www/vhosts/domain.tld/iris.domain.tld/vendor/slim/slim/Slim/Middleware/Flash.php(85): Slim\Slim->call() #12 /var/www/vhosts/domain.tld/iris.domain.tld/vendor/slim/slim/Slim/Middleware/MethodOverride.php(92): Slim\Middleware\Flash->call() #13 /var/www/vhosts/domain.tld/iris.domain.tld/application/Espo/Core/Utils/Api/Auth.php(138): Slim\Middleware\MethodOverride->call() #14 /var/www/vhosts/domain.tld/iris.domain.tld/application/Espo/Core/Utils/Api/Slim.php(125): Espo\Core\Utils\Api\Auth->call() #15 /var/www/vhosts/domain.tld/iris.domain.tld/application/Espo/Core/Application.php(93): Espo\Core\Utils\Api\Slim->run() #16 /var/www/vhosts/domain.tld/iris.domain.tld/api/v1/index.php(33): Espo\Core\Application->run() #17 {main}  Next Doctrine\DBAL\DBALException: An exception occurred while executing 'ALTER TABLE `lead` ADD iddetnumine VARCHAR(255) DEFAULT NULL COLLATE utf8mb4_unicode_ci':  SQLSTATE[42000]: Syntax error or access violation: 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. You have to change some columns to TEXT or BLOBs in /var/www/vhosts/domain.tld/iris.domain.tld/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:91 Stack trace: #0 /var/www/vhosts/domain.tld/iris.domain.tld/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(702): Doctrine\DBAL\DBALException::driverExceptionDuringQuery(Object(PDOException), 'ALTER TABLE `le...', Array) #1 /var/www/vhosts/domain.tld/iris.domain.tld/application/Espo/Core/Utils/Database/Schema/Schema.php(196): Doctrine\DBAL\Connection->executeQuery('ALTER TABLE `le...') #2 /var/www/vhosts/domain.tld/iris.domain.tld/application/Espo/Core/DataManager.php(95): Espo\Core\Utils\Database\Schema\Schema->rebuild('Lead') #3 /var/www/vhosts/domain.tld/iris.domain.tld/application/Espo/Core/DataManager.php(62): Espo\Core\DataManager->rebuildDatabase('Lead') #4 /var/www/vhosts/domain.tld/iris.domain.tld/application/Espo/Controllers/FieldManager.php(71): Espo\Core\DataManager->rebuild('Lead') #5 /var/www/vhosts/domain.tld/iris.domain.tld/application/Espo/Core/ControllerManager.php(143): Espo\Controllers\FieldManager->postActionCreate(Array, Object(stdClass), Object(Slim\Http\Request), Object(Slim\Http\Response)) #6 /var/www/vhosts/domain.tld/iris.domain.tld/application/Espo/Core/ControllerManager.php(159): Espo\Core\ControllerManager->processRequest(Object(Espo\Controllers\FieldManager), 'create', Array, Object(stdClass), Object(Slim\Http\Request), Object(Slim\Http\Response)) #7 /var/www/vhosts/domain.tld/iris.domain.tld/application/Espo/Core/Application.php(296): ... [] []
          [2019-04-16 17:15:10] Espo.ERROR: API [POST]:/Admin/fieldManager/:scope, Params:Array (     [scope] => Lead ) , InputData: {"type":"varchar","required":false,"trim":true,"dynamicLogicVisible":null,"dynamicLogicRequired":null,"dynamicLogicReadOnly":null,"name":"iddetnumine","label":"Numero INE","tooltipText":null,"isPersonalData":false,"inlineEditDisabled":false,"default":null,"maxLength":null,"options":[],"audited":false,"readOnly":false,"tooltip":false} - Error while rebuilding database. See log file for details. [] []
          [2019-04-16 17:15:10] Espo.ERROR: Display Error: Error while rebuilding database. See log file for details., Code: 500 URL: /api/v1/Admin/fieldManager/Lead [] []
          Last edited by PGI; 04-16-2019, 05:22 PM.

          Comment

          • Maximus
            Senior Member
            • Nov 2018
            • 2731

            #6
            PDOException: SQLSTATE[42000]: Syntax error or access violation: 1118 Row size too large.
            The maximum row size for the used table type, not counting BLOBs, is 65535. You have to change some columns to TEXT or BLOBs
            This means that you don't have enough row space for this new field in your DB. For varchar field, the default length is 255 and for the checkbox (boolean) it is only 1.

            Please read this https://dev.mysql.com/doc/refman/5.7...unt-limit.html to understand why this error has appeared and how you can fix it.

            Also, you can use this way https://github.com/espocrm/espocrm/issues/447.
            For this, you should add manually this new field into /EspoCRM/custom/Espo/Custom/Resources/metadata/entityDefs/Lead.json with this parameter: "maxLength": 150. Try to rebuild. If this error will appear again try to change "maxLength" to 100 and rebuild again.
            Last edited by Maximus; 04-17-2019, 08:33 AM.

            Comment

            • PGI
              Member
              • Oct 2017
              • 77

              #7
              Good evening,

              Thank you, I didn't understand where this problem could come from. I deleted some obsolete fields in the entity and now it works.

              When we delete a field via EspoCRM, it still exists in the database, should we delete the field with phpMyAdmin then?

              Comment

              • rodrigocoelho
                Active Community Member
                • Jun 2016
                • 296

                #8
                Originally posted by PGI
                Good evening,

                Thank you, I didn't understand where this problem could come from. I deleted some obsolete fields in the entity and now it works.

                When we delete a field via EspoCRM, it still exists in the database, should we delete the field with phpMyAdmin then?
                I'm having the same messages on my LOG. I had to delete some fields manually. Some of them was used by EspoCRM on the paste, like ContactID, and now they are not used anymore.
                I don't know when yuri changed the used fields, but, the SQL didn't purge the obsolete ones.

                Comment

                • Maximus
                  Senior Member
                  • Nov 2018
                  • 2731

                  #9
                  This is how it works. Deleting a field from EspoCRM doesn't take an effect on it in the DB.
                  If you have deleted some obsolete fields from EspoCRM and want to delete them from DB, go ahead. But make sure that these obsolete fields are not using in any logic or don't have any connections to your records, to prevent new issues.

                  Comment

                  • rodrigocoelho
                    Active Community Member
                    • Jun 2016
                    • 296

                    #10
                    Ok maximus, but why SQL is giving that error messages.

                    Comment

                    • Maximus
                      Senior Member
                      • Nov 2018
                      • 2731

                      #11
                      Please read this https://dev.mysql.com/doc/refman/5.7...unt-limit.html

                      Comment

                      Working...