Dec 15, 2017
0
Level 1
Cipher exception when deploying Laravel to Elastic Beanstalk
Ok I'm starting to lose my mind here. When I deploy my app to elastic beanstalk I get this error:
[2017-12-15 17:50:18] Tylercd100\LERN.CRITICAL: RuntimeException was thrown! The only supported ciphers are AES-128-CBC and AES-256-CBC with the correct key lengths. #0 /var/app/current/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php(27): Illuminate\Encryption\Encrypter->__construct('\xEB]\xD5\xBD\xD8\xA6\(\xDBB\xE5\x7F\x8B_:...', 'AES-256-CBC') #1 /var/app/current/vendor/laravel/framework/src/Illuminate/Container/Container.php(726): Illuminate\Encryption\EncryptionServiceProvider->Illuminate\Encryption\{closure}(Object(Illuminate\Foundation\Application), Array) #2 /var/app/current/vendor/laravel/framework/src/Illuminate/Container/Container.php(608): Illuminate\Container\Container->build(Object(Closure)) #3 /var/app/current/vendor/laravel/framework/src/Illuminate/Container/Container.php(575): Illuminate\Container\Container->resolve('encrypter') #4 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(728): Illuminate\Container\Container->make('encrypter') #5 /var/app/current/vendor/laravel/framework/src/Illuminate/Container/Container.php(862): Illuminate\Foundation\Application->make('encrypter') #6 /var/app/current/vendor/laravel/framework/src/Illuminate/Container/Container.php(790): Illuminate\Container\Container->resolveClass(Object(ReflectionParameter)) #7 /var/app/current/vendor/laravel/framework/src/Illuminate/Container/Container.php(757): Illuminate\Container\Container->resolveDependencies(Array) #8 /var/app/current/vendor/laravel/framework/src/Illuminate/Container/Container.php(608): Illuminate\Container\Container->build('App\Http\Middle...') #9 /var/app/current/vendor/laravel/framework/src/Illuminate/Container/Container.php(575): Illuminate\Container\Container->resolve('App\Http\Middle...') #10 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(728): Illuminate\Container\Container->make('App\Http\Middle...') #11 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(213): Illuminate\Foundation\Application->make('App\Http\Middle...') #12 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(187): Illuminate\Foundation\Http\Kernel->terminateMiddleware(Object(Illuminate\Http\Request), Object(Illuminate\Http\Response)) #13 /var/app/current/public/index.php(58): Illuminate\Foundation\Http\Kernel->terminate(Object(Illuminate\Http\Request), Object(Illuminate\Http\Response)) #14 {main} [] []
To be clear I deploy my app source without dependencies installed and with APP_KEY not set, I'm leaving the dependency installation to elastic beanstalk which installs them during deployment.
In my aws .config file I have defined deployment commands as follows:
---
commands:
00init:
command: "sudo yum install gcc-c++"
01init:
command: "rm -f amazon-elasticache-cluster-client.so"
02init:
command: "wget https://s3.amazonaws.com/php-amazon-elasticache-cluster-client-7-1/amazon-elasticache-cluster-client.so"
03init:
command: "sudo mv amazon-elasticache-cluster-client.so /usr/lib64/php/7.1/modules/"
04init:
command: "echo \"extension=amazon-elasticache-cluster-client.so\" | sudo tee /etc/php-7.1.d/50-memcached.ini"
05init:
command: "sudo /etc/init.d/httpd restart"
container_commands:
00permissions:
command: "find * -type d -print0 | xargs -0 chmod 0755"
01permissions:
command: "find . -type f -print0 | xargs -0 chmod 0644"
02permissions:
command: "chmod -R 775 storage bootstrap/cache"
03cache:
command: "php artisan cache:clear"
04key:
command: "php artisan key:generate"
05cache:
command: "php artisan config:cache"
06cache:
command: "php artisan route:cache"
07optimize:
command: "php artisan optimize"
These commands are running during deployment to aws without any error.
When I go and check .env directly on the virtual machine the APP_KEY is set as it should be considering the commands above.
Yet I get the cipher error.
Please or to participate in this conversation.