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

Failed to import users: failed to validate user #600

Closed
Richigeht opened this issue Feb 25, 2019 · 12 comments
Closed

Failed to import users: failed to validate user #600

Richigeht opened this issue Feb 25, 2019 · 12 comments

Comments

@Richigeht
Copy link

Describe the bug
I try to migrate my data from Kimai V1 but I do get an error then I try to do so.

To Reproduce
Steps to reproduce the behavior:

  1. bin/console kimai:import-v1 "mysql://kuser:.xxx@127.0.0.1:3306/kimai?charset=latin1" "kimai_" ".xxx" -vvv

Logfile
[ERROR] Failed to import users: Failed to validate user: xxx
#0 /var/www/kimai2/src/Command/KimaiImporterCommand.php(263):
App\Command\KimaiImporterCommand->importUsers(Object(Symfony\Component\Console\Style\SymfonyStyle), '.xxx',
Array, Array)
#1 /var/www/kimai2/vendor/symfony/console/Command/Command.php(255):
App\Command\KimaiImporterCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput),
Object(Symfony\Component\Console\Output\ConsoleOutput))
#2 /var/www/kimai2/vendor/symfony/console/Application.php(911):
Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput),
Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /var/www/kimai2/vendor/symfony/framework-bundle/Console/Application.php(89):
Symfony\Component\Console\Application->doRunCommand(Object(App\Command\KimaiImporterCommand),
Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 /var/www/kimai2/vendor/symfony/console/Application.php(262):
Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand(Object(App\Command\KimaiImporterCommand),
Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#5 /var/www/kimai2/vendor/symfony/framework-bundle/Console/Application.php(75):
Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput),
Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 /var/www/kimai2/vendor/symfony/console/Application.php(145):
Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput),
Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 /var/www/kimai2/bin/console(39):
Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput))
#8 {main}

Screenshots

Additional context
Add any other context about the problem here.

  • Kimai version 0.8.3
    . - PHP version 7.3

If I could get more information on where to find logs etc. I would troubleshoot this myself.
I also do get:
[ERROR] Object(App\Entity\User).email:
This value is not a valid email address. (code bd79c0ab-ddba-46cc-a703-a7a4b08de310)

However I checked now all mail addresses and they are actually correct.

@kevinpapst
Copy link
Member

kevinpapst commented Feb 25, 2019

Did you check the emails in the Kimai 1 database?
Kimai 1 was terrible when it comes to data integrity. I already added multiple workarounds for defect data, but that one is very likely on your end.
If your database is really okay, I would need a dump of at least the users table for debugging.
There is just var/logs/prod.log and I don't know if the import logs there.

You could add some debug comments around this code:
https://github.com/kevinpapst/kimai2/blob/master/src/Command/KimaiImporterCommand.php#L511

The error is coming from the Symfony framework and says:
const INVALID_FORMAT_ERROR = 'bd79c0ab-ddba-46cc-a703-a7a4b08de310';
but I don't know what that means.
What is the email adress of that user? Simply replace all chars with x to prevent abuse if you paste it here.

@Richigeht
Copy link
Author

Richigeht commented Feb 25, 2019 via email

@Richigeht
Copy link
Author

Hi,
apparently the address included a "," instead of a "." hence the error. Also it does not like duplicates but at least the users are imported now.
The rest of the data gets imported now - hopefully without issues.

@kevinpapst
Copy link
Member

Was everything successful, or did you find anything else?

@Richigeht
Copy link
Author

Richigeht commented Mar 1, 2019 via email

@kevinpapst
Copy link
Member

You already closed it. But I have had several issues with the import in the past, as Kimai 1 didn't use foreign keys and produced a lot of broken relationships/invalid data.
I'd be glad to fix these problems, just let me know what happened!

@Richigeht
Copy link
Author

Richigeht commented Mar 4, 2019 via email

@kevinpapst
Copy link
Member

Had a look at the code and you might be correct. If it fails again, please add these lines here:
https://github.com/kevinpapst/kimai2/blob/master/src/Command/KimaiImporterCommand.php#L962

            if (empty($oldRecord['end']) || $oldRecord['end'] === 0) {
                $io->error('Cannot import running timesheet record, skipping: ' . $oldRecord['timeEntryID']);
                continue;
            }

@Richigeht
Copy link
Author

Hi
I manipulated the data it worked now. Some users were disabled after the migration but I just modified it in the database as well (since it's just a test import it does also not really matter).

@kevinpapst
Copy link
Member

You manipulated the data any our Kimai 1 database?

Please share our insights with me, so I can improve the importer!

@Richigeht
Copy link
Author

Yeah; I just made a simple update statement to make the END=START time for those entries with end value 0.
After that I had to just check some users which have been set to "enabled=0" in the users table. Not sure why that was since those have been active on kimai1 however just checking the data: it looks like they had a banTime set against them.

@lock
Copy link

lock bot commented May 3, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. If you use Kimai on a daily basis, please consider donating to support further development of Kimai.

@lock lock bot locked and limited conversation to collaborators May 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants