My version is v4.7.5, 500 errors occurred when the asset was imported. Now debugging mode log information is enabled as follows:
root@8c2670604451:/var/www/html/storage/logs# tail -f laravel.log
[2019-08-15 13:05:00] production.ERROR: SymfonyComponentDebugExceptionFatalThrowableError: Type error: Argument 1 passed to SpatieDbDumperDbDumper::setPort() must be of the type integer, string given, called in /var/www/html/vendor/spatie/laravel-backup/src/Tasks/Backup/DbDumperFactory.php on line 36 in /var/www/html/vendor/spatie/db-dumper/src/DbDumper.php:117
Stack trace:
[2019-08-15 13:05:00] production.ERROR: Type error: Argument 1 passed to SpatieDbDumperDbDumper::setPort() must be of the type integer, string given, called in /var/www/html/vendor/spatie/laravel-backup/src/Tasks/Backup/DbDumperFactory.php on line 36 {"userId":3,"exception":"[object] (Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): Type error: Argument 1 passed to Spatie\DbDumper\DbDumper::setPort() must be of the type integer, string given, called in /var/www/html/vendor/spatie/laravel-backup/src/Tasks/Backup/DbDumperFactory.php on line 36 at /var/www/html/vendor/spatie/db-dumper/src/DbDumper.php:117)
[stacktrace]
"}
What do you have for your DB_PORT in your .env?
@snipe Ran across this issue and that ENV VAR worked.
To add something else to your plate, that VAR isn't mentioned anywhere in the docs.
I was trying to run on Docker with the 4.7.7 container (in kubernetes) and adding the DB_PORT variable fixed this specific issue. Didn't find it in the doc indeed.
Fixed it for me as well. Not working backups also blocked the import assistant from working.
Is this still relevant? We haven't heard from anyone in a bit. If so, please comment with any updates or additional detail.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Don't take it personally, we just need to keep a handle on things. Thank you for your contributions!
This issue has been automatically closed because it has not had recent activity. If you believe this is still an issue, please confirm that this issue is still happening in the most recent version of Snipe-IT and reply to this thread to re-open it.
I don't think this issue should have been closed; there has been no repair to resolve it and docs don't reflect the DB_PORT being required in the first place. really it should just be defaulted somewhere; it's strange to fail on this one error.
DB_PORT is not required. It never has been. It defaults to the... default port.
@snipe That is incorrect. Attempting a manual backup from within a docker container generates this error:
root@3baab39ca490:/var/www/html# php artisan snipeit:backup
Starting backup...
In DbDumper.php line 117:
Type error: Argument 1 passed to Spatie\DbDumper\DbDumper::setPort() must be of the type integer, string given, cal
led in /var/www/html/vendor/spatie/laravel-backup/src/Tasks/Backup/DbDumperFactory.php on line 36
Backups through the web interface likewise generate the same error. Please either reopen this issue or update your documentation.
@snipe @MikeFathom5 A workarround just to unlock backups (very clever on production) :
Edit file /var/www/html/vendor/spatie/laravel-backup/src/Tasks/Backup/DbDumperFactory.php in container and change line 36 like this :
$dbDumper = $dbDumper->setPort(intval($dbConfig['port']));
鈿狅笍 it's not a good idea to do it like this permanently, we need changes from snipe to avoid this bug.
I started having this issue in 4.9.1 specifically. I use a name unix socket, not TCP for my database so this was throwing the error on me. I updated my_env_file with DB_PORT=0 and it resolved the issue without the code changes.
same conclusion as @mikemackintosh.
Adding MYSQL_PORT_3306_TCP_PORT=3306 to my .env file resolved the issue without any other changes needed.
(using docker )
Most helpful comment
What do you have for your
DB_PORTin your .env?