Describe the bug
The upgrade to v5 fails using the php upgrade.php script.
To Reproduce
Steps to reproduce the behavior:
Attempt upgrade using php upgrade.php from v4.9.5 using the environment below.
Expected behavior
For the upgrade to go swimmingly.
Screenshots
N/A
Server (please complete the following information):
Error Messages
The environment file is invalid!
Failed to parse dotenv file due to an invalid name. Failed at [REDIS_PORT-null].
This error appears in multiple locations within the upgrade script. See full output below.
Additional context
ubuntu@portal:/var/www/assets-dev$ php upgrade.php
Welcome to the Snipe-IT upgrader.
Please note that this script will not download the latest Snipe-IT
files for you unless you have git installed.
It simply runs the standard composer and artisan
commands needed to finalize the upgrade after.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! If you have any encrypted custom fields, BE SURE TO run the recrypter if upgrading from v3 to v4.
!! See the Snipe-IT documentation for help:
!! https://snipe-it.readme.io/docs/upgrading-to-v4
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
--------------------------------------------------------
STEP 1: Backing up database:
--------------------------------------------------------
-- Starting backup...
Dumping database assets_dev...
Determining files to backup...
Zipping 796 files...
Created zip containing 796 files. Size is 9.33 MB
Copying zip to disk named local...
Successfully copied zip to disk named local.
Backup completed!
--------------------------------------------------------
STEP 2: Putting application into maintenance mode:
--------------------------------------------------------
-- Application is now in maintenance mode.
--------------------------------------------------------
STEP 3: Pulling latest from Git (master branch):
--------------------------------------------------------
Git is installed.
Previous HEAD position was b9e19468e Bumped version for v4.9.5
Switched to branch 'master'
-- -- Saved working directory and index state WIP on master: 870b097f0 Derp. Should be master
-- M public/uploads/barcodes/invalid_barcode.gif
M storage/private_uploads/signatures/.gitkeep
Your branch is up to date with 'origin/master'.
-- Already up to date.
--------------------------------------------------------
Step 4: Cleaning up old cached files:
--------------------------------------------------------
-- No bootstrap/cache/compiled.php, so nothing to delete.
-- Deleting bootstrap/cache/services.php. It it no longer used.
-- Deleting bootstrap/cache/config.php. It it no longer used.
--
In AuthServiceProvider.php line 92:
Call to undefined method Laravel\Passport\Passport::withCookieSerialization()
--
In AuthServiceProvider.php line 92:
Call to undefined method Laravel\Passport\Passport::withCookieSerialization()
--
In AuthServiceProvider.php line 92:
Call to undefined method Laravel\Passport\Passport::withCookieSerialization()
--
In AuthServiceProvider.php line 92:
Call to undefined method Laravel\Passport\Passport::withCookieSerialization()
--------------------------------------------------------
Step 5: Updating composer dependencies:
(This may take an moment.)
--------------------------------------------------------
-- Local composer.phar detected, so we'll use that.
-- Updating local composer.phar
Downloading (100%)
[RuntimeException]
SHA384 is not supported by your openssl extension, could not verify the phar file integrity
self-update [-r|--rollback] [--clean-backups] [--no-progress] [--update-keys] [--stable] [--preview] [--snapshot] [--set-channel-only] [--] [<version>]
Updating to version 1.10.15 (stable channel).
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
Loading composer repositories with package information
Installing dependencies from lock file
Package operations: 26 installs, 47 updates, 11 removals
- Removing symfony/polyfill-util (v1.16.0)
- Removing symfony/polyfill-php70 (v1.16.0)
- Removing symfony/polyfill-php56 (v1.16.0)
- Removing schuppo/password-strength (v1.13)
- Removing predis/predis (v1.1.1)
- Removing mtdowling/cron-expression (v1.2.3)
- Removing kylekatarnls/update-helper (1.2.1)
- Removing jakub-onderka/php-console-highlighter (v0.4)
- Removing jakub-onderka/php-console-color (v0.2)
- Removing dasprid/enum (1.0.0)
- Removing alek13/slack (1.11.0)
- Updating bacon/bacon-qr-code (2.0.0 => 1.0.3): Checking out 5a91b62b9d
- Updating symfony/finder (v3.4.40 => v4.4.7): Checking out 5729f943f9
- Updating symfony/debug (v3.4.40 => v4.4.7): Checking out 346636d2ca
- Updating symfony/polyfill-php72 (v1.16.0 => v1.15.0): Checking out 37b0976c78
- Updating symfony/polyfill-mbstring (v1.16.0 => v1.15.0): Checking out 81ffd3a9c6
- Updating symfony/var-dumper (v3.4.40 => v4.4.7): Checking out 5a0c2d9300
- Updating maximebf/debugbar (v1.16.3 => v1.16.2): Checking out 40f375504a
- Updating symfony/polyfill-ctype (v1.16.0 => v1.15.0): Checking out 4719fa9c18
- Installing phpoption/phpoption (1.7.3): Cloning 4acfd6a4b3 from cache
- Updating vlucas/phpdotenv (v2.6.4 => v3.6.3): Checking out 1b31030137
- Updating symfony/css-selector (v3.1.10 => v4.4.7): Checking out afc26133a6
- Updating symfony/routing (v3.4.40 => v4.4.7): Checking out 0f562fa613
- Updating symfony/process (v3.4.40 => v4.4.7): Checking out 3e40e87a20
- Installing symfony/polyfill-php73 (v1.15.0): Cloning 0f27e9f464 from cache
- Updating symfony/polyfill-intl-idn (v1.16.0 => v1.15.0): Checking out 47bd6aa45b
- Installing symfony/mime (v4.4.7): Cloning 6dde9dc701 from cache
- Updating symfony/http-foundation (v3.4.40 => v4.4.7): Checking out 62f92509c9
- Installing symfony/event-dispatcher-contracts (v1.1.7): Cloning c43ab68567 from cache
- Updating symfony/event-dispatcher (v3.4.40 => v4.4.7): Checking out abc8e3618b
- Installing symfony/error-handler (v4.4.7): Cloning 7e9828fc98 from cache
- Updating symfony/http-kernel (v3.4.40 => v4.4.7): Checking out f356a489e5
- Installing symfony/service-contracts (v1.1.8): Cloning ffc7f56920 from cache
- Updating symfony/console (v3.4.40 => v4.4.7): Checking out 10bb3ee3c9
- Updating symfony/polyfill-iconv (v1.16.0 => v1.15.0): Checking out ad6d62792b
- Updating doctrine/lexer (1.0.2 => 1.2.0): Checking out 5242d66dbe
- Updating paragonie/random_compat (v2.0.18 => v9.99.99): Checking out 84b4dfb120
- Installing opis/closure (3.5.1): Cloning 93ebc5712c from cache
- Installing symfony/translation-contracts (v1.1.7): Cloning 364518c132 from cache
- Updating symfony/translation (v3.4.40 => v4.4.7): Checking out 4e54d336f2
- Updating nesbot/carbon (1.39.1 => 2.32.2): The package has modified files:
M bin/upgrade-carbon
Discard changes [y,n,v,d,s,?]? y
Checking out f10e22cf54
- Updating monolog/monolog (1.25.3 => 2.0.2): Checking out c861fcba2c
- Installing league/commonmark (1.4.1): Cloning c995966d35 from cache
- Installing dragonmantank/cron-expression (v2.3.0): Cloning 72b6fbf76a from cache
- Updating laravel/framework (v5.5.49 => v6.18.10): Checking out 9177744ccd
- Updating barryvdh/laravel-debugbar (v3.3.3 => v3.3.2): Checking out 95c31aab33
- Updating doctrine/collections (v1.5.0 => 1.6.4): Checking out 6b1e4b2b66
- Updating doctrine/dbal (v2.9.0 => 2.10.2): Checking out aab745e7b6
- Updating symfony/psr-http-message-bridge (v1.2.0 => v2.0.0): Checking out ce709cd9c9
- Installing psr/http-factory (1.0.1): Cloning 12ac7fcd07 from cache
- Installing php-http/message-factory (v1.0.2): Cloning a478cb11f6 from cache
- Installing nyholm/psr7 (1.2.1): Cloning 55ff6b7657 from cache
- Updating league/oauth2-server (6.1.1 => 8.0.0): Checking out e1dc4d708c
- Installing laminas/laminas-zendframework-bridge (1.0.3): Cloning bfbbdb6c99 from cache
- Updating laminas/laminas-diactoros (1.8.7 => 2.2.3): Checking out b596c7141f
- Updating laravel/passport (v4.0.3 => v8.4.4): Checking out dd4b1d96eb
- Updating psy/psysh (v0.9.12 => v0.10.3): Checking out 2bde2fa03e
- Updating laravel/tinker (v1.0.10 => v2.4.0): Checking out cde90a7335
- Updating laravelcollective/html (v5.5.4 => v6.0.3): Checking out bcc317d21a
- Updating phpdocumentor/reflection-common (2.1.0 => 2.0.0): Checking out 63a995caa1
- Updating phpdocumentor/type-resolver (1.0.1 => 1.1.0): Checking out 7462d5f123
- Updating phpdocumentor/reflection-docblock (4.3.4 => 5.1.0): Checking out cd72d394ca
- Updating pragmarx/google2fa (v5.0.0 => 8.0.0): Checking out 26c4c5cf30
- Updating rollbar/rollbar (v1.8.1 => v2.0.0): Checking out 245670b32d
- Updating rollbar/rollbar-laravel (v2.4.3 => v6.0.0): Checking out 11df7e1931
- Updating sebastian/diff (2.0.1 => 3.0.2): Checking out 720fcc7e9b
- Updating sebastian/comparator (2.1.3 => 3.0.2): Checking out 5de4fc177a
- Updating spatie/temporary-directory (1.1.5 => 1.2.2): Checking out fcb127e615
- Updating spatie/db-dumper (2.13.1 => 2.16.0): Checking out 7c6d3b7f71
- Updating spatie/laravel-backup (5.12.1 => 6.9.0): Checking out d92ff3a676
- Updating tightenco/ziggy (v0.7.1 => v0.9.0): Checking out 5344605c9f
- Updating watson/validating (3.3.0 => 4.0.0): Checking out b8731af37e
- Installing tightenco/collect (v7.6.1): Cloning 4b6a215656 from cache
- Installing adldap2/adldap2 (v10.2.3): Cloning 2baffac2df from cache
- Installing laravel/helpers (v1.2.0): Cloning 1f978fc5da from cache
- Installing laravel/slack-notification-channel (v2.0.2): Cloning ecc90a7079 from cache
- Installing mtdowling/jmespath.php (2.5.0): Cloning 52168cb947 from cache
- Installing aws/aws-sdk-php (3.135.1): Cloning 59587a4f3f from cache
- Installing league/flysystem-aws-s3-v3 (1.0.24): Cloning 4382036bde from cache
- Installing psr/cache (1.0.1): Cloning d11b50ad22 from cache
- Installing league/flysystem-cached-adapter (1.0.9): Cloning 08ef74e9be from cache
- Installing maknz/slack (1.7.0): Cloning 7f21fefc70 from cache
- Installing robrichards/xmlseclibs (3.1.0): Cloning 8d8e56ca79 from cache
- Installing onelogin/php-saml (3.4.1): Cloning 5fbf348670 from cache
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
Carbon 1 is deprecated, see how to migrate to Carbon 2.
https://carbon.nesbot.com/docs/#api-carbon-2
You can run './vendor/bin/upgrade-carbon' to get help in updating carbon and other frameworks and libraries that depend on it.
--------------------------------------------------------
Step 6: Migrating database:
--------------------------------------------------------
The environment file is invalid!
Failed to parse dotenv file due to an invalid name. Failed at [REDIS_PORT-null].
--
--------------------------------------------------------
Step 7: Checking for OAuth keys:
--------------------------------------------------------
- OAuth keys detected. Skipping passport install.
--------------------------------------------------------
Step 8: Caching routes and config:
--------------------------------------------------------
The environment file is invalid!
Failed to parse dotenv file due to an invalid name. Failed at [REDIS_PORT-null].
The environment file is invalid!
Failed to parse dotenv file due to an invalid name. Failed at [REDIS_PORT-null].
-- --
--------------------------------------------------------
Step 9: Taking application out of maintenance mode:
--------------------------------------------------------
The environment file is invalid!
Failed to parse dotenv file due to an invalid name. Failed at [REDIS_PORT-null].
--
--------------------------------------------------------
FINISHED! Clear your browser cookies and re-login to use :
your upgraded Snipe-IT.
--------------------------------------------------------
馃憢 Thanks for opening your first issue here! If you're reporting a 馃悶 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.
Upgraded production straight to v5 (yes, not the best idea) & encountered an error, so I rolled back to v4 & created a dev instance to test the upgrade again. Managed to reproduce the same error I got when I upgraded production the first time. Logged the results via this issue.
After a closer look, the env file is _indeed invalid_ lol. REDIS_PORT has a - instead of an =, which is probably why validation failed. Changing this & re-running the upgrade resolved the env error but popped up another one related to a file in /bootstrap/cache. Clearing that directory seemed to fix that error.
I was able to resolve the upgrade issues entirely (to my knowledge). After validating the env file & clearing the /bootstrap/cache directory to get rid of the first two issues, I also had to manually copy all of the uploads from /storage/app/public to /public/uploads (which is contradictory to what the upgrade script suggests). Closing this issue out since the problems are solved.
Here is a step-by-step list of what I did to resolve the upgrade.
php upgrade.php./bootstrap/cache directory./public/uploads directory & then cp /storage/app/public/* /public/uploads/ to copy the image assets to the appropriate locations.Referencing #8550 and #8552 in case this might help those issues.
Edit: Some additional steps to try if only the above does not work:
php artisan cache:clear, php artisan config:clear, php artisan route:clear, php artisan view:clear./vendor directory and do a fresh install of dependencies using php composer.phar install --no-dev --prefer-sourceinformation_schema table as a privileged user (usually root). If you run into that problem.@nbently thanks so much for posting this. The public uploads shouldn't matter here, as those are all just static files (literally just images, PDFS, etc that have been uploaded) which have no bearing on the system at large.
My guess here (as in the other ticket associated) is that the .env parser is more strict in later versions of Laravel (the framework we use), so small syntax errors that would have been overlooked by the system are no longer overlooked.
@snipe no problem! Thanks for all the hard work 馃榿
System functioned without issue after I got those first two issues resolved, just didn't display any images until I copied over those files. Spot on re Laravel's .env parser. It occurred to me that there was probably a big Laravel version jump in the v5 upgrade only after I tried the upgrade.
It was a big jump, yes :( We hadn't planned on THAT big of a jump, but there were some security issues within the framework that forced us to drag everything forward a bit. Which is part of the reason for the delay. I'm writing up a post-mortem on why this thing took so long now, and I'll post it when I'm done. I'm deeply appreciative of everyone's patience here. It's been at least as frustrating on our end as it has been for folks waiting.
This was extremely helpful. Thanks!
I had the same issue and reverted to a snapshot for the VM after fighting with the problems.
I will try this asap !
@nbently thanks buddy, you just saved me too!
Most helpful comment
It was a big jump, yes :( We hadn't planned on THAT big of a jump, but there were some security issues within the framework that forced us to drag everything forward a bit. Which is part of the reason for the delay. I'm writing up a post-mortem on why this thing took so long now, and I'll post it when I'm done. I'm deeply appreciative of everyone's patience here. It's been at least as frustrating on our end as it has been for folks waiting.