Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration - Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes #1468

Closed
schweizersolutions opened this issue Jun 19, 2022 · 2 comments

Comments

@schweizersolutions
Copy link

How Shlink is set-up

  • Shlink Version: 2.7.1 -> 3.1.2
  • PHP Version: 8.1
  • How do you serve Shlink: Self-hosted nginx
  • Database engine used: MariaDB (10.1.48-MariaDB-0+deb9u2)

Summary

Try to update version 2.7.1 to 3.1.2 with migrating the configuration of the old version, runs into an error.

I migrated it version by version and got from 2.7.1 to 2.10.3 successfully. As soon as I want to migrate from 2.10.3 to the 3.0.0 I get the error message.

This error message also appears when trying to migrate from 2.7.1 directly to 3.0.0 or 3.1.2.

/var/customers/webs/customer/shlink3.1.2_php8.0_dist# vendor/bin/shlink-installer update -vvv

 Custom configuration properly generated!

Updating database... [Running "/usr/bin/php8.1 bin/cli db:migrate"]   RUN  '/usr/bin/php8.1' 'bin/cli' 'db:migrate'
  OUT  Migrating database...
  OUT
  ERR    RUN  '/usr/bin/php8.1' 'vendor/doctrine/migrations/bin/doctrine-migrations.php' 'migrations:migrate' '--no-interaction'
  ERR    ERR
  ERR    ERR  In ExceptionConverter.php line 119:
  ERR    ERR
  ERR    ERR    [Doctrine\DBAL\Exception\DriverException (1071)]
  ERR    ERR    An exception occurred while executing a query: SQLSTATE[42000]: Syntax erro
  ERR    ERR    r or access violation: 1071 Specified key was too long; max key length is 7
  ERR    ERR    67 bytes
  ERR    ERR
  ERR    ERR
  ERR    ERR  Exception trace:
  ERR    ERR    at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php:119
  ERR    ERR   Doctrine\DBAL\Driver\API\MySQL\ExceptionConverter->convert() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/dbal/src/Connection.php:1814
  ERR    ERR   Doctrine\DBAL\Connection->handleDriverException() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/dbal/src/Connection.php:1749
  ERR    ERR   Doctrine\DBAL\Connection->convertExceptionDuringQuery() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/dbal/src/Connection.php:1055
  ERR    ERR   Doctrine\DBAL\Connection->executeQuery() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/lib/Doctrine/Migrations/Version/DbalExecutor.php:293
  ERR    ERR   Doctrine\Migrations\Version\DbalExecutor->executeResult() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/lib/Doctrine/Migrations/Version/DbalExecutor.php:172
  ERR    ERR   Doctrine\Migrations\Version\DbalExecutor->executeMigration() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/lib/Doctrine/Migrations/Version/DbalExecutor.php:95
  ERR    ERR   Doctrine\Migrations\Version\DbalExecutor->execute() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/lib/Doctrine/Migrations/DbalMigrator.php:107
  ERR    ERR   Doctrine\Migrations\DbalMigrator->executePlan() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/lib/Doctrine/Migrations/DbalMigrator.php:71
  ERR    ERR   Doctrine\Migrations\DbalMigrator->executeMigrations() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/lib/Doctrine/Migrations/DbalMigrator.php:157
  ERR    ERR   Doctrine\Migrations\DbalMigrator->migrate() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/lib/Doctrine/Migrations/Tools/Console/Command/MigrateCommand.php:210
  ERR    ERR   Doctrine\Migrations\Tools\Console\Command\MigrateCommand->execute() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/symfony/console/Command/Command.php:291
  ERR    ERR   Symfony\Component\Console\Command\Command->run() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/symfony/console/Application.php:998
  ERR    ERR   Symfony\Component\Console\Application->doRunCommand() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/symfony/console/Application.php:299
  ERR    ERR   Symfony\Component\Console\Application->doRun() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/symfony/console/Application.php:171
  ERR    ERR   Symfony\Component\Console\Application->run() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/lib/Doctrine/Migrations/Tools/Console/ConsoleRunner.php:95
  ERR    ERR   Doctrine\Migrations\Tools\Console\ConsoleRunner::run() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/bin/doctrine-migrations.php:45
  ERR    ERR   Doctrine\Migrations\{closure}() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/bin/doctrine-migrations.php:46
  ERR    ERR
  ERR    ERR  In Exception.php line 30:
  ERR    ERR
  ERR    ERR    [Doctrine\DBAL\Driver\PDO\Exception (1071)]
  ERR    ERR    SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was t
  ERR    ERR    oo long; max key length is 767 bytes
  ERR    ERR
  ERR    ERR
  ERR    ERR  Exception trace:
  ERR    ERR    at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/dbal/src/Driver/PDO/Exception.php:30
  ERR    ERR   Doctrine\DBAL\Driver\PDO\Exception::new() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/dbal/src/Driver/PDO/Connection.php:77
  ERR    ERR   Doctrine\DBAL\Driver\PDO\Connection->query() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/dbal/src/Connection.php:1050
  ERR    ERR   Doctrine\DBAL\Connection->executeQuery() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/lib/Doctrine/Migrations/Version/DbalExecutor.php:293
  ERR    ERR   Doctrine\Migrations\Version\DbalExecutor->executeResult() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/lib/Doctrine/Migrations/Version/DbalExecutor.php:172
  ERR    ERR   Doctrine\Migrations\Version\DbalExecutor->executeMigration() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/lib/Doctrine/Migrations/Version/DbalExecutor.php:95
  ERR    ERR   Doctrine\Migrations\Version\DbalExecutor->execute() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/lib/Doctrine/Migrations/DbalMigrator.php:107
  ERR    ERR   Doctrine\Migrations\DbalMigrator->executePlan() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/lib/Doctrine/Migrations/DbalMigrator.php:71
  ERR    ERR   Doctrine\Migrations\DbalMigrator->executeMigrations() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/lib/Doctrine/Migrations/DbalMigrator.php:157
  ERR    ERR   Doctrine\Migrations\DbalMigrator->migrate() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/lib/Doctrine/Migrations/Tools/Console/Command/MigrateCommand.php:210
  ERR    ERR   Doctrine\Migrations\Tools\Console\Command\MigrateCommand->execute() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/symfony/console/Command/Command.php:291
  ERR    ERR   Symfony\Component\Console\Command\Command->run() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/symfony/console/Application.php:998
  ERR    ERR   Symfony\Component\Console\Application->doRunCommand() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/symfony/console/Application.php:299
  ERR    ERR   Symfony\Component\Console\Application->doRun() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/symfony/console/Application.php:171
  ERR    ERR   Symfony\Component\Console\Application->run() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/lib/Doctrine/Migrations/Tools/Console/ConsoleRunner.php:95
  ERR    ERR   Doctrine\Migrations\Tools\Console\ConsoleRunner::run() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/bin/doctrine-migrations.php:45
  ERR    ERR   Doctrine\Migrations\{closure}() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/bin/doctrine-migrations.php:46
  ERR    ERR
  ERR    ERR  In Connection.php line 72:
  ERR    ERR
  ERR    ERR    [PDOException (42000)]
  ERR    ERR    SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was t
  ERR    ERR    oo long; max key length is 767 bytes
  ERR    ERR
  ERR    ERR
  ERR    ERR  Exception trace:
  ERR    ERR    at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/dbal/src/Driver/PDO/Connection.php:72
  ERR    ERR   PDO->query() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/dbal/src/Driver/PDO/Connection.php:72
  ERR    ERR   Doctrine\DBAL\Driver\PDO\Connection->query() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/dbal/src/Connection.php:1050
  ERR    ERR   Doctrine\DBAL\Connection->executeQuery() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/lib/Doctrine/Migrations/Version/DbalExecutor.php:293
  ERR    ERR   Doctrine\Migrations\Version\DbalExecutor->executeResult() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/lib/Doctrine/Migrations/Version/DbalExecutor.php:172
  ERR    ERR   Doctrine\Migrations\Version\DbalExecutor->executeMigration() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/lib/Doctrine/Migrations/Version/DbalExecutor.php:95
  ERR    ERR   Doctrine\Migrations\Version\DbalExecutor->execute() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/lib/Doctrine/Migrations/DbalMigrator.php:107
  ERR    ERR   Doctrine\Migrations\DbalMigrator->executePlan() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/lib/Doctrine/Migrations/DbalMigrator.php:71
  ERR    ERR   Doctrine\Migrations\DbalMigrator->executeMigrations() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/lib/Doctrine/Migrations/DbalMigrator.php:157
  ERR    ERR   Doctrine\Migrations\DbalMigrator->migrate() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/lib/Doctrine/Migrations/Tools/Console/Command/MigrateCommand.php:210
  ERR    ERR   Doctrine\Migrations\Tools\Console\Command\MigrateCommand->execute() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/symfony/console/Command/Command.php:291
  ERR    ERR   Symfony\Component\Console\Command\Command->run() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/symfony/console/Application.php:998
  ERR    ERR   Symfony\Component\Console\Application->doRunCommand() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/symfony/console/Application.php:299
  ERR    ERR   Symfony\Component\Console\Application->doRun() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/symfony/console/Application.php:171
  ERR    ERR   Symfony\Component\Console\Application->run() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/lib/Doctrine/Migrations/Tools/Console/ConsoleRunner.php:95
  ERR    ERR   Doctrine\Migrations\Tools\Console\ConsoleRunner::run() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/bin/doctrine-migrations.php:45
  ERR    ERR   Doctrine\Migrations\{closure}() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/bin/doctrine-migrations.php:46
  ERR    ERR
  ERR    ERR  migrations:migrate [--write-sql [WRITE-SQL]] [--dry-run] [--query-time] [--allow-no-migration] [--all-or-nothing [ALL-OR-NOTHING]] [--configuration CONFIGURATION] [--em EM] [--conn CONN] [--] [<version>]
  ERR    ERR
  ERR    ERR
  ERR  In Process.php line 267:
  ERR
  ERR    [Symfony\Component\Process\Exception\ProcessFailedException]
  ERR    The command "'/usr/bin/php8.1' 'vendor/doctrine/migrations/bin/doctrine-mig
  ERR    rations.php' 'migrations:migrate' '--no-interaction'" failed.
  ERR
  ERR    Exit Code: 255(Unknown error)
  ERR
  ERR    Working directory: /var/customers/webs/customer/shlink3.1.2_php8.0_dist
  ERR
  ERR    Output:
  ERR    ================
  ERR
  ERR
  ERR    Error Output:
  ERR    ================
  ERR
  ERR    In ExceptionConverter.php line 119:
  ERR
  ERR
  ERR      [Doctrine\DBAL\Exception\DriverException (1071)]
  ERR
  ERR      An exception occurred while executing a query: SQLSTATE[42000]: Syntax er
  ERR    ro
  ERR      r or access violation: 1071 Specified key was too long; max key length is
  ERR     7
  ERR      67 bytes
  ERR
  ERR
  ERR
  ERR
  ERR    Exception trace:
  ERR      at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine
  ERR    /dbal/src/Driver/API/MySQL/ExceptionConverter.php:119
  ERR     Doctrine\DBAL\Driver\API\MySQL\ExceptionConverter->convert() at /var/custo
  ERR    mers/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/dbal/src/Conne
  ERR    ction.php:1814
  ERR     Doctrine\DBAL\Connection->handleDriverException() at /var/customers/webs/a
  ERR    schweizer/shlink3.1.2_php8.0_dist/vendor/doctrine/dbal/src/Connection.php:1
  ERR    749
  ERR     Doctrine\DBAL\Connection->convertExceptionDuringQuery() at /var/customers/
  ERR    webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/dbal/src/Connection
  ERR    .php:1055
  ERR     Doctrine\DBAL\Connection->executeQuery() at /var/customers/webs/customer
  ERR    /shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/lib/Doctrine/Migrations
  ERR    /Version/DbalExecutor.php:293
  ERR     Doctrine\Migrations\Version\DbalExecutor->executeResult() at /var/customer
  ERR    s/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/lib/Do
  ERR    ctrine/Migrations/Version/DbalExecutor.php:172
  ERR     Doctrine\Migrations\Version\DbalExecutor->executeMigration() at /var/custo
  ERR    mers/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/lib
  ERR    /Doctrine/Migrations/Version/DbalExecutor.php:95
  ERR     Doctrine\Migrations\Version\DbalExecutor->execute() at /var/customers/webs
  ERR    /customer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/lib/Doctrine
  ERR    /Migrations/DbalMigrator.php:107
  ERR     Doctrine\Migrations\DbalMigrator->executePlan() at /var/customers/webs/asc
  ERR    hweizer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/lib/Doctrine/Mig
  ERR    rations/DbalMigrator.php:71
  ERR     Doctrine\Migrations\DbalMigrator->executeMigrations() at /var/customers/we
  ERR    bs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/lib/Doctri
  ERR    ne/Migrations/DbalMigrator.php:157
  ERR     Doctrine\Migrations\DbalMigrator->migrate() at /var/customers/webs/aschwei
  ERR    zer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/lib/Doctrine/Migrati
  ERR    ons/Tools/Console/Command/MigrateCommand.php:210
  ERR     Doctrine\Migrations\Tools\Console\Command\MigrateCommand->execute() at /va
  ERR    r/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/symfony/console/
  ERR    Command/Command.php:291
  ERR     Symfony\Component\Console\Command\Command->run() at /var/customers/webs/as
  ERR    chweizer/shlink3.1.2_php8.0_dist/vendor/symfony/console/Application.php:998
  ERR     Symfony\Component\Console\Application->doRunCommand() at /var/customers/we
  ERR    bs/customer/shlink3.1.2_php8.0_dist/vendor/symfony/console/Application.ph
  ERR    p:299
  ERR     Symfony\Component\Console\Application->doRun() at /var/customers/webs/asch
  ERR    weizer/shlink3.1.2_php8.0_dist/vendor/symfony/console/Application.php:171
  ERR     Symfony\Component\Console\Application->run() at /var/customers/webs/aschwe
  ERR    izer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/lib/Doctrine/Migrat
  ERR    ions/Tools/Console/ConsoleRunner.php:95
  ERR     Doctrine\Migrations\Tools\Console\ConsoleRunner::run() at /var/customers/w
  ERR    ebs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/bin/doctr
  ERR    ine-migrations.php:45
  ERR     Doctrine\Migrations\{closure}() at /var/customers/webs/customer/shlink3.
  ERR    1.2_php8.0_dist/vendor/doctrine/migrations/bin/doctrine-migrations.php:46
  ERR
  ERR    In Exception.php line 30:
  ERR
  ERR
  ERR      [Doctrine\DBAL\Driver\PDO\Exception (1071)]
  ERR
  ERR      SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was
  ERR     t
  ERR      oo long; max key length is 767 bytes
  ERR
  ERR
  ERR
  ERR
  ERR    Exception trace:
  ERR      at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine
  ERR    /dbal/src/Driver/PDO/Exception.php:30
  ERR     Doctrine\DBAL\Driver\PDO\Exception::new() at /var/customers/webs/aschweize
  ERR    r/shlink3.1.2_php8.0_dist/vendor/doctrine/dbal/src/Driver/PDO/Connection.ph
  ERR    p:77
  ERR     Doctrine\DBAL\Driver\PDO\Connection->query() at /var/customers/webs/aschwe
  ERR    izer/shlink3.1.2_php8.0_dist/vendor/doctrine/dbal/src/Connection.php:1050
  ERR     Doctrine\DBAL\Connection->executeQuery() at /var/customers/webs/customer
  ERR    /shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/lib/Doctrine/Migrations
  ERR    /Version/DbalExecutor.php:293
  ERR     Doctrine\Migrations\Version\DbalExecutor->executeResult() at /var/customer
  ERR    s/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/lib/Do
  ERR    ctrine/Migrations/Version/DbalExecutor.php:172
  ERR     Doctrine\Migrations\Version\DbalExecutor->executeMigration() at /var/custo
  ERR    mers/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/lib
  ERR    /Doctrine/Migrations/Version/DbalExecutor.php:95
  ERR     Doctrine\Migrations\Version\DbalExecutor->execute() at /var/customers/webs
  ERR    /customer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/lib/Doctrine
  ERR    /Migrations/DbalMigrator.php:107
  ERR     Doctrine\Migrations\DbalMigrator->executePlan() at /var/customers/webs/asc
  ERR    hweizer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/lib/Doctrine/Mig
  ERR    rations/DbalMigrator.php:71
  ERR     Doctrine\Migrations\DbalMigrator->executeMigrations() at /var/customers/we
  ERR    bs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/lib/Doctri
  ERR    ne/Migrations/DbalMigrator.php:157
  ERR     Doctrine\Migrations\DbalMigrator->migrate() at /var/customers/webs/aschwei
  ERR    zer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/lib/Doctrine/Migrati
  ERR    ons/Tools/Console/Command/MigrateCommand.php:210
  ERR     Doctrine\Migrations\Tools\Console\Command\MigrateCommand->execute() at /va
  ERR    r/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/symfony/console/
  ERR    Command/Command.php:291
  ERR     Symfony\Component\Console\Command\Command->run() at /var/customers/webs/as
  ERR    chweizer/shlink3.1.2_php8.0_dist/vendor/symfony/console/Application.php:998
  ERR     Symfony\Component\Console\Application->doRunCommand() at /var/customers/we
  ERR    bs/customer/shlink3.1.2_php8.0_dist/vendor/symfony/console/Application.ph
  ERR    p:299
  ERR     Symfony\Component\Console\Application->doRun() at /var/customers/webs/asch
  ERR    weizer/shlink3.1.2_php8.0_dist/vendor/symfony/console/Application.php:171
  ERR     Symfony\Component\Console\Application->run() at /var/customers/webs/aschwe
  ERR    izer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/lib/Doctrine/Migrat
  ERR    ions/Tools/Console/ConsoleRunner.php:95
  ERR     Doctrine\Migrations\Tools\Console\ConsoleRunner::run() at /var/customers/w
  ERR    ebs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/bin/doctr
  ERR    ine-migrations.php:45
  ERR     Doctrine\Migrations\{closure}() at /var/customers/webs/customer/shlink3.
  ERR    1.2_php8.0_dist/vendor/doctrine/migrations/bin/doctrine-migrations.php:46
  ERR
  ERR    In Connection.php line 72:
  ERR
  ERR
  ERR      [PDOException (42000)]
  ERR
  ERR      SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was
  ERR     t
  ERR      oo long; max key length is 767 bytes
  ERR
  ERR
  ERR
  ERR
  ERR    Exception trace:
  ERR      at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine
  ERR    /dbal/src/Driver/PDO/Connection.php:72
  ERR     PDO->query() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/ven
  ERR    dor/doctrine/dbal/src/Driver/PDO/Connection.php:72
  ERR     Doctrine\DBAL\Driver\PDO\Connection->query() at /var/customers/webs/aschwe
  ERR    izer/shlink3.1.2_php8.0_dist/vendor/doctrine/dbal/src/Connection.php:1050
  ERR     Doctrine\DBAL\Connection->executeQuery() at /var/customers/webs/customer
  ERR    /shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/lib/Doctrine/Migrations
  ERR    /Version/DbalExecutor.php:293
  ERR     Doctrine\Migrations\Version\DbalExecutor->executeResult() at /var/customer
  ERR    s/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/lib/Do
  ERR    ctrine/Migrations/Version/DbalExecutor.php:172
  ERR     Doctrine\Migrations\Version\DbalExecutor->executeMigration() at /var/custo
  ERR    mers/webs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/lib
  ERR    /Doctrine/Migrations/Version/DbalExecutor.php:95
  ERR     Doctrine\Migrations\Version\DbalExecutor->execute() at /var/customers/webs
  ERR    /customer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/lib/Doctrine
  ERR    /Migrations/DbalMigrator.php:107
  ERR     Doctrine\Migrations\DbalMigrator->executePlan() at /var/customers/webs/asc
  ERR    hweizer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/lib/Doctrine/Mig
  ERR    rations/DbalMigrator.php:71
  ERR     Doctrine\Migrations\DbalMigrator->executeMigrations() at /var/customers/we
  ERR    bs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/lib/Doctri
  ERR    ne/Migrations/DbalMigrator.php:157
  ERR     Doctrine\Migrations\DbalMigrator->migrate() at /var/customers/webs/aschwei
  ERR    zer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/lib/Doctrine/Migrati
  ERR    ons/Tools/Console/Command/MigrateCommand.php:210
  ERR     Doctrine\Migrations\Tools\Console\Command\MigrateCommand->execute() at /va
  ERR    r/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/symfony/console/
  ERR    Command/Command.php:291
  ERR     Symfony\Component\Console\Command\Command->run() at /var/customers/webs/as
  ERR    chweizer/shlink3.1.2_php8.0_dist/vendor/symfony/console/Application.php:998
  ERR     Symfony\Component\Console\Application->doRunCommand() at /var/customers/we
  ERR    bs/customer/shlink3.1.2_php8.0_dist/vendor/symfony/console/Application.ph
  ERR    p:299
  ERR     Symfony\Component\Console\Application->doRun() at /var/customers/webs/asch
  ERR    weizer/shlink3.1.2_php8.0_dist/vendor/symfony/console/Application.php:171
  ERR     Symfony\Component\Console\Application->run() at /var/customers/webs/aschwe
  ERR    izer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/lib/Doctrine/Migrat
  ERR    ions/Tools/Console/ConsoleRunner.php:95
  ERR     Doctrine\Migrations\Tools\Console\ConsoleRunner::run() at /var/customers/w
  ERR    ebs/customer/shlink3.1.2_php8.0_dist/vendor/doctrine/migrations/bin/doctr
  ERR    ine-migrations.php:45
  ERR     Doctrine\Migrations\{closure}() at /var/customers/webs/customer/shlink3.
  ERR    1.2_php8.0_dist/vendor/doctrine/migrations/bin/doctrine-migrations.php:46
  ERR
  ERR    migrations:migrate [--write-sql [WRITE-SQL]] [--dry-run] [--query-time] [--
  ERR    allow-no-migration] [--all-or-nothing [ALL-OR-NOTHING]] [--configuration CO
  ERR    NFIGURATION] [--em EM] [--conn CONN] [--] [<version>]
  ERR
  ERR
  ERR  Exception trace:
  ERR    at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/symfony/process/Process.php:267
  ERR   Symfony\Component\Process\Process->mustRun() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/module/CLI/src/Util/ProcessRunner.php:48
  ERR   Shlinkio\Shlink\CLI\Util\ProcessRunner->run() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/module/CLI/src/Command/Db/AbstractDatabaseCommand.php:30
  ERR   Shlinkio\Shlink\CLI\Command\Db\AbstractDatabaseCommand->runPhpCommand() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/module/CLI/src/Command/Db/MigrateDatabaseCommand.php:31
  ERR   Shlinkio\Shlink\CLI\Command\Db\MigrateDatabaseCommand->lockedExecute() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/module/CLI/src/Command/Util/AbstractLockedCommand.php:35
  ERR   Shlinkio\Shlink\CLI\Command\Util\AbstractLockedCommand->execute() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/symfony/console/Command/Command.php:291
  ERR   Symfony\Component\Console\Command\Command->run() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/symfony/console/Application.php:998
  ERR   Symfony\Component\Console\Application->doRunCommand() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/symfony/console/Application.php:299
  ERR   Symfony\Component\Console\Application->doRun() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/vendor/symfony/console/Application.php:171
  ERR   Symfony\Component\Console\Application->run() at /var/customers/webs/customer/shlink3.1.2_php8.0_dist/bin/cli:10
  ERR
  ERR  db:migrate
  ERR
  ERR
  RES  1 Command did not run successfully

Current behavior

Expected behavior

How to reproduce

@acelaya
Copy link
Member

acelaya commented Jun 20, 2022

You need to update to a newest MariaDB version.

Related to this #1358

@acelaya acelaya removed the bug label Jun 20, 2022
@acelaya acelaya closed this as not planned Won't fix, can't repro, duplicate, stale Jun 20, 2022
@Roy-Orbison
Copy link
Contributor

I had a rather bumpy upgrade from 2.10.3 to 3.4.0, as it didn't seem to respect the majority of the existing settings values, so I copied and pasted manually, then ran into this same error. I didn't want to update the default system version of MariaDB if I didn't have to, as Shlink is not the only service on the machine, so I checked which keys were actually affected by the limit. In all cases they were on VARCAHR(255) columns where values are unlikely to be that length. I don't think many Shlink users have domains, shortcodes and tags greater than 191 chars, because that would defeat the normal purpose of using a URL shortener. I manually changed the columns with the following SQL commands:

ALTER TABLE `short_urls`
	MODIFY `short_code` varchar(191) COLLATE 'utf8_bin' NOT NULL AFTER `original_url`,
	MODIFY `import_original_short_code` varchar(191) COLLATE 'utf8_unicode_ci' NULL AFTER `import_source`;
ALTER TABLE `domains`
	MODIFY `authority` varchar(191) COLLATE 'utf8_unicode_ci' NOT NULL AFTER `id`;
ALTER TABLE `tags`
	MODIFY `name` varchar(191) COLLATE 'utf8_unicode_ci' NOT NULL AFTER `id`;

I can't tell if this is sufficient to work around the issue because afterwards visiting the site root spat out this:

An unexpected error occurred

The List short URLs and Overview pages on the management web app say:

Something went wrong while loading short URLs :(

I can see the API call to list URLs produces the same error response as visiting the root. However, the app pages for domains, tags, etc., work fine. @acelaya What's the quickest way I can get proper errors to debug the cause? Shlink isn't writing anything to the PHP error logs. This might be a separate issue, but I'd rather make sure it isn't related to the upgrade, first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants