Migration error (0.email must valid)

I’m trying to migrate from v4.5.50 to latest v5 version but the migration fails.

The migration fails and I receive an email with this message:

{"0.email":["The 0.email must be a valid email address."]}
{"0.email":["The 0.email must be a valid email address."]}
  • V5 is clean installed with docker-compose on Debian 12 and the env file has been configured.
  • Username and password are set the same as the old install
  • This looks similar to this post, but the company I’m trying to migrate contains only 1 user with my @hotmail.com account (under v4 Advanced Settings > User Management)
  • I cannot find any other empty email fields in the v4 settings

The app container show this in the log:

  2024-08-09 10:19:01 App\Jobs\Util\StartMigration ................... RUNNING
  2024-08-09 10:19:02 App\Jobs\Util\StartMigration ............. 784.82ms FAIL
  2024-08-09 10:20:00 Running [queue-size-job] .................. 20.15ms DONE
  2024-08-09 10:20:00 Running [Callback] ......................... 9.90ms DONE
  2024-08-09 10:20:00 App\Jobs\Ninja\QueueSize ....................... RUNNING
  2024-08-09 10:20:00 App\Jobs\Ninja\QueueSize ................... 3.26ms DONE

In the laravel.log is get this:

[2024-08-09 10:19:01] production.INFO: Importing account  
[2024-08-09 10:19:02] production.INFO: Importing company  
[2024-08-09 10:19:02] production.INFO: Importing users  
[2024-08-09 10:19:03] production.ERROR: Serialization of 'Closure' is not allowed {"userId":1,"exception":"[object] (Exception(code: 0): Serialization of 'Closure' is not allowed at /var/www/app/vendor/laravel/framework/src/Illuminate/Queue/Queue.php:160)
[stacktrace]
#0 /var/www/app/vendor/laravel/framework/src/Illuminate/Queue/Queue.php(160): serialize(Object(Illuminate\\Events\\CallQueuedListener))
#1 /var/www/app/vendor/laravel/framework/src/Illuminate/Queue/Queue.php(129): Illuminate\\Queue\\Queue->createObjectPayload(Object(Illuminate\\Events\\CallQueuedListener), 'default')
#2 /var/www/app/vendor/laravel/framework/src/Illuminate/Queue/Queue.php(107): Illuminate\\Queue\\Queue->createPayloadArray(Object(Illuminate\\Events\\CallQueuedListener), 'default', '')
#3 /var/www/app/vendor/laravel/framework/src/Illuminate/Queue/DatabaseQueue.php(92): Illuminate\\Queue\\Queue->createPayload(Object(Illuminate\\Events\\CallQueuedListener), 'default', '')
#4 /var/www/app/vendor/laravel/framework/src/Illuminate/Queue/Queue.php(59): Illuminate\\Queue\\DatabaseQueue->push(Object(Illuminate\\Events\\CallQueuedListener), '', NULL)
#5 /var/www/app/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(633): Illuminate\\Queue\\Queue->pushOn(NULL, Object(Illuminate\\Events\\CallQueuedListener))
#6 /var/www/app/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(552): Illuminate\\Events\\Dispatcher->queueHandler('App\\\\Listeners\\\\M...', 'handle', Array)
#7 /var/www/app/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(478): Illuminate\\Events\\Dispatcher->Illuminate\\Events\\{closure}(Object(Illuminate\\Mail\\Events\\MessageSent))
#8 /var/www/app/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(286): Illuminate\\Events\\Dispatcher->Illuminate\\Events\\{closure}('Illuminate\\\\Mail...', Array)
#9 /var/www/app/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(266): Illuminate\\Events\\Dispatcher->invokeListeners('Illuminate\\\\Mail...', Array, false)
#10 /var/www/app/vendor/laravel/framework/src/Illuminate/Mail/Mailer.php(618): Illuminate\\Events\\Dispatcher->dispatch('Illuminate\\\\Mail...')
#11 /var/www/app/vendor/laravel/framework/src/Illuminate/Mail/Mailer.php(337): Illuminate\\Mail\\Mailer->dispatchSentEvent(Object(Illuminate\\Mail\\SentMessage), Array)
#12 /var/www/app/vendor/laravel/framework/src/Illuminate/Mail/Mailable.php(205): Illuminate\\Mail\\Mailer->send('email.migration...', Array, Object(Closure))
#13 /var/www/app/vendor/laravel/framework/src/Illuminate/Support/Traits/Localizable.php(19): Illuminate\\Mail\\Mailable->Illuminate\\Mail\\{closure}()
#14 /var/www/app/vendor/laravel/framework/src/Illuminate/Mail/Mailable.php(198): Illuminate\\Mail\\Mailable->withLocale(NULL, Object(Closure))
#15 /var/www/app/vendor/laravel/framework/src/Illuminate/Mail/Mailer.php(354): Illuminate\\Mail\\Mailable->send(Object(Illuminate\\Mail\\Mailer))
#16 /var/www/app/vendor/laravel/framework/src/Illuminate/Mail/Mailer.php(301): Illuminate\\Mail\\Mailer->sendMailable(Object(App\\Mail\\MigrationFailed))
#17 /var/www/app/vendor/laravel/framework/src/Illuminate/Mail/PendingMail.php(124): Illuminate\\Mail\\Mailer->send(Object(App\\Mail\\MigrationFailed))
#18 /var/www/app/app/Jobs/Util/StartMigration.php(148): Illuminate\\Mail\\PendingMail->send(Object(App\\Mail\\MigrationFailed))
#19 /var/www/app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\\Jobs\\Util\\StartMigration->handle()
#20 /var/www/app/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#21 /var/www/app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure(Object(Closure))
#22 /var/www/app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure))
#23 /var/www/app/vendor/laravel/framework/src/Illuminate/Container/Container.php(690): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL)
#24 /var/www/app/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(128): Illuminate\\Container\\Container->call(Array)
#25 /var/www/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\\Bus\\Dispatcher->Illuminate\\Bus\\{closure}(Object(App\\Jobs\\Util\\StartMigration))
#26 /var/www/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(App\\Jobs\\Util\\StartMigration))
#27 /var/www/app/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(132): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#28 /var/www/app/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(124): Illuminate\\Bus\\Dispatcher->dispatchNow(Object(App\\Jobs\\Util\\StartMigration), false)
#29 /var/www/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\\Queue\\CallQueuedHandler->Illuminate\\Queue\\{closure}(Object(App\\Jobs\\Util\\StartMigration))
#30 /var/www/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(App\\Jobs\\Util\\StartMigration))
#31 /var/www/app/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(123): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#32 /var/www/app/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(71): Illuminate\\Queue\\CallQueuedHandler->dispatchThroughMiddleware(Object(Illuminate\\Queue\\Jobs\\DatabaseJob), Object(App\\Jobs\\Util\\StartMigration))
#33 /var/www/app/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(102): Illuminate\\Queue\\CallQueuedHandler->call(Object(Illuminate\\Queue\\Jobs\\DatabaseJob), Array)
#34 /var/www/app/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(439): Illuminate\\Queue\\Jobs\\Job->fire()
#35 /var/www/app/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(389): Illuminate\\Queue\\Worker->process('database', Object(Illuminate\\Queue\\Jobs\\DatabaseJob), Object(Illuminate\\Queue\\WorkerOptions))
#36 /var/www/app/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(176): Illuminate\\Queue\\Worker->runJob(Object(Illuminate\\Queue\\Jobs\\DatabaseJob), 'database', Object(Illuminate\\Queue\\WorkerOptions))
#37 /var/www/app/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(139): Illuminate\\Queue\\Worker->daemon('database', 'default', Object(Illuminate\\Queue\\WorkerOptions))
#38 /var/www/app/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(122): Illuminate\\Queue\\Console\\WorkCommand->runWorker('database', 'default')
#39 /var/www/app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\\Queue\\Console\\WorkCommand->handle()
#40 /var/www/app/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#41 /var/www/app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure(Object(Closure))
#42 /var/www/app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure))
#43 /var/www/app/vendor/laravel/framework/src/Illuminate/Container/Container.php(690): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL)
#44 /var/www/app/vendor/laravel/framework/src/Illuminate/Console/Command.php(213): Illuminate\\Container\\Container->call(Array)
#45 /var/www/app/vendor/symfony/console/Command/Command.php(279): Illuminate\\Console\\Command->execute(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))
#46 /var/www/app/vendor/laravel/framework/src/Illuminate/Console/Command.php(182): Symfony\\Component\\Console\\Command\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))
#47 /var/www/app/vendor/symfony/console/Application.php(1047): Illuminate\\Console\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#48 /var/www/app/vendor/symfony/console/Application.php(316): Symfony\\Component\\Console\\Application->doRunCommand(Object(Illuminate\\Queue\\Console\\WorkCommand), Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#49 /var/www/app/vendor/symfony/console/Application.php(167): Symfony\\Component\\Console\\Application->doRun(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#50 /var/www/app/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(197): Symfony\\Component\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#51 /var/www/app/artisan(35): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#52 {main}
"}

Hi,

Do all records in the users table have valid email addresses?

I was able to migrate the “main” company few minutes ago. But that’s an old one I don’t need.
The one I’m trying to migrate gives the 0.email error.

These users exist in the V4.5.50 database:

MariaDB [ninja]> SELECT id, username, email FROM `users`;
+----+---------------------------+---------------------------+
| id | username                  | email                     |
+----+---------------------------+---------------------------+
|  1 | [email protected]  | [email protected]  |
|  3 | DavidW2                   | [email protected]  |
|  5 | DavidW3                   | [email protected]  |
|  6 | DavidW4                   | [email protected]  |
|  7 | DavidW5                   | [email protected]  |
+----+---------------------------+---------------------------+

Admittedly, I’ve never done the migration myself. However, dealing with database issues in the past, made me wonder if the issue is arising because the first user has a username and email address that are identical?

Because they’re different fields in the database, that is probably not the problem, I’m just not sure how the migration script handles it and if that’s where the issue comes from.

When I add an additional test company in V4, also an emailadres gets used as the username:

|  8 | [email protected]          | [email protected]   

The second user was related to the company I wanted to migrate.
After changing the username to an emailadres, the company did succesfully migrate without errors. It wouldn’t let me use the same emailadres as ID1, so ended up doing this instead:

UPDATE `users` SET username = '[email protected]' WHERE ID = 3

My database was first installed in 2016, I have no clue why those usernames did not contain an emailadres.

2 Likes