I received this error when trying to upgrade using the UI. Restored and tried again with the same result:

The website encountered an unexpected error. Please try again later.

Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes: ALTER TABLE node__yamlform CHANGE yamlform_target_id webform_target_id varchar(255); Array ( ) in Drupal\yamlform_to_webform\YamlFormToWebformMigrateManager->renameColumns() (line 349 of modules/yamlform/modules/yamlform_to_webform/src/YamlFormToWebformMigrateManager.php).

I just upgraded the Drupal core 8.2.4 which came out 12/7.

After this error, if I try to do anything else on the site, it just gives this error:

Fatal error: Class name must be a valid object or a string in /home/.../public_html/core/modules/field/src/FieldStorageConfigStorage.php on line 155

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jlsegul created an issue. See original summary.

jrockowitz’s picture

I think the issue is you must have YAML forms with very long machine names. Am I right?

I will try to replicate the issue locally. I suspect I am going to be forced to limit YAML form machine names to 128 characters instead of 255.

http://stackoverflow.com/questions/1814532/1071-specified-key-was-too-lo...

jrockowitz’s picture

Priority: Major » Critical

Yep, the yamlform field's target id is currently 255 character when it needs to be 32 characters. I am going to have to write an update hook to fix this.

Hopefully I can use system_update_8007 as starting point for the needed update hook.

jrockowitz’s picture

Status: Active » Needs review

I could not replicate the issue but I am willing to bet the yamlform target_id's field length being 255 characters when it should 32 characters is causing the problem.

Please test #2834203: Convert yamlform field target_id from 255 characters to 32 characters. and see if it fixes your migration.

javjaff’s picture

Thanks. Migration without the patch to yamlform throw error "Fatal error: Class name must be a valid object or a string" indeed.
I had restored backup which I made before migration, applied the patch, then I used Drupal update.php and migrated Yaml form to Webform.
Second time everything went smoothly.

jrockowitz’s picture

Status: Needs review » Fixed

@javjaff Thanks for the confirmation. I committed the patch and will mark this issue as fixed.

TipiT’s picture

I got the same problem. After trying this patch (meaning the dev version dev-8.x-1.x b9b1c55) did not solve my problem to migrate the forms. Also went through long machine names but I don't think I have any what might have something to do which yamlform module.

How ever when debugging (see below) the solution was to drop table "field_deleted_data_fd554c0f39" and "field_deleted_revision_fd554c0f39" tables. After that the migrate went fine. I don't what the yamlform_to_webform module exactly does which these database tables because the table was empty anyway.

I don't know if this helps to clarify something but at least I want to say a lot of thanks to you @jrockowitz for the effort!

---

...
Next Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[HY000]: General error: 1709 Index column size too large. The maximum column size is 767 bytes.: ALTER TABLE field_deleted_data_021965de79 CHANGE yamlform_target_id
webform_target_id varchar(255); Array ()
in /var/www/finn-us/web/core/lib/Drupal/Core/Database/Connection.php:671
Stack trace:
#0 /var/www/finn-us/web/core/lib/Drupal/Core/Database/Connection.php(635): Drupal\Core\Database\Connection->handleQueryException(Object(PDOException), 'ALTER TABLE fie...', Array, Array)
#1 /var/www/finn-us/web/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php(81): Drupal\Core\Database\Connection->query('ALTER TABLE fie...', Array, Array)
#2 /var/www/finn-us/web/modules/contrib/yamlform/modules/yamlform_to_webform/src/YamlFormToWebformMigrateManager.php(353): Drupal\Core\Database\Driver\mysql\Connection->query('ALTER TABLE fie...')
#3 /var/www/finn-us/web/modules/contrib/yamlform/modules/yamlform_to_webform/src/YamlFormToWebformMigrateManager.php(223): Drupal\yamlform_to_webform\YamlFormToWebformMigrateManager->renameColumns('field_deleted_d...')
#4 /var/www/finn-us/web/modules/contrib/yamlform/modules/yamlform_to_webform/yamlform_to_webform.drush.inc(68): Drupal\yamlform_to_webform\YamlFormToWebformMigrateManager->migrate()
#5 /var/www/finn-us/vendor/drush/drush/includes/command.inc(422): drush_yamlform_to_webform_migrate()
#6 /var/www/finn-us/vendor/drush/drush/includes/command.inc(231): _drush_invoke_hooks(Array, Array)
#7 /var/www/finn-us/vendor/drush/drush/includes/command.inc(199): drush_command()
#8 /var/www/finn-us/vendor/drush/drush/lib/Drush/Boot/BaseBoot.php(67): drush_dispatch(Array)
#9 /var/www/finn-us/vendor/drush/drush/includes/preflight.inc(66): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#10 /var/www/finn-us/vendor/drush/drush/drush.php(12): drush_main()
#11 {main}

jrockowitz’s picture

Status: Fixed » Needs review

@TipiT Before deleting the field_deleted_data_021965de79 table did you check and see if you had any fields pending deletion in the Status Report.

Your error makes sense because the field_deleted_data_021965de79 contains an old broken yamlform field definition where the target_id column is still 255 characters when it needs to be changed to 32 characters. Instead of deleting the table next time change the target_id character limit from 255 to 32 and see if that fixes the issue.

TipiT’s picture

I don't think there was none and I can't seems to think why there might be. But I am not 100% sure. I even deleted all submitted forms before the migration because because I thought that might be the obstacle.

jrockowitz’s picture

The field_deleted_data tables are created when you delete a field. These table should be deleted when cron is run.

jrockowitz’s picture

Attached patch requires all pending field deletions to occur before a migration and might prevent this error from happening.

TipiT’s picture

Very good. I think that was it! Nice job.

jrockowitz’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.