Whoops, looks like something went wrong. Laravel 5.1
Asked Answered
F

1

7

I have a route like this

http://localhost/inspection/show/{id}

When I try to load the route at the same time. In different tabs, sometimes some of those tabs has the error "Whoops, looks like something went wrong"

Loading in different tabs so fast

http://localhost/inspection/show/8
http://localhost/inspection/show/9
http://localhost/inspection/show/10
http://localhost/inspection/show/11

The stack trace have this

[2015-08-06 14:57:53] local.ERROR: exception 'RuntimeException' with message 'No supported encrypter found. The cipher and / or key length are invalid.' in C:\wamp\www\iaserver\vendor\laravel\framework\src\Illuminate\Encryption\EncryptionServiceProvider.php:29
Stack trace:
#0 C:\wamp\www\iaserver\vendor\laravel\framework\src\Illuminate\Container\Container.php(733): Illuminate\Encryption\EncryptionServiceProvider->Illuminate\Encryption\{closure}(Object(Illuminate\Foundation\Application), Array)
#1 C:\wamp\www\iaserver\vendor\laravel\framework\src\Illuminate\Container\Container.php(626): Illuminate\Container\Container->build(Object(Closure), Array)
#2 C:\wamp\www\iaserver\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(674): Illuminate\Container\Container->make('encrypter', Array)
#3 C:\wamp\www\iaserver\vendor\laravel\framework\src\Illuminate\Container\Container.php(837): Illuminate\Foundation\Application->make('Illuminate\\Cont...')
#4 C:\wamp\www\iaserver\vendor\laravel\framework\src\Illuminate\Container\Container.php(800): Illuminate\Container\Container->resolveClass(Object(ReflectionParameter))
#5 C:\wamp\www\iaserver\vendor\laravel\framework\src\Illuminate\Container\Container.php(771): Illuminate\Container\Container->getDependencies(Array, Array)
#6 C:\wamp\www\iaserver\vendor\laravel\framework\src\Illuminate\Container\Container.php(626): Illuminate\Container\Container->build('IAServer\\Http\\M...', Array)
#7 C:\wamp\www\iaserver\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(674): Illuminate\Container\Container->make('IAServer\\Http\\M...', Array)
#8 C:\wamp\www\iaserver\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(143): Illuminate\Foundation\Application->make('IAServer\\Http\\M...')
#9 C:\wamp\www\iaserver\public\index.php(58): Illuminate\Foundation\Http\Kernel->terminate(Object(Illuminate\Http\Request), Object(Illuminate\Http\Response))
#10 {main} 

The .env file is correct, i re-run php artisan key:generate

APP_ENV=local
APP_DEBUG=true
APP_KEY=UC5Fsvi8JsGG4U72k04rS3o5csiINDYB

But the error still appears only when the route is quickly loaded with different id.

Why?

I solved, sometimes laravel not read APP_KEY in .ENV. And returns a value "SomeRandomString" (default is defined in config / app.php), and have the error "key length is invalid", so the solution is to copy the value of APP_KEY, to the value 'key 'in config / app.php, that's all! I solved!

Focal answered 6/8, 2015 at 15:17 Comment(8)
Does your other pages work fine in Laravel?Adigranth
Yes !, works great !, just some tabs have that error.Focal
I think you need to post your inspection controller and view codeAdigranth
I solved, sometimes laravel not read APP_KEY in .ENV. And returns a value "SomeRandomString" (default is defined in config / app.php), and have the error "key length is invalid", so the solution is to copy the value of APP_KEY, to the value 'key 'in config / app.php, that's all! I solved!Focal
You don't want to replace the config file's default value if you're still using the .env file because that defeats the purpose of using it in the first place. What version of PHP are you running?Bendy
I'm using WAMP with Apache/2.4.9 (Win64) PHP/5.5.12. Sometimes the error appears when i try to use a different connection, by now, i changed my configuration from .env to config.php suggestions?Focal
Please answer and mark as finished so your question does not show up on the unanswered list.Reductase
it's not finished, still appears the error, sometimes Laravel not read the .env file, and load the default value in app.phpFocal
U
1

You may try to run php artisan key:generate again, this should solve the problem.

Ustulation answered 4/11, 2015 at 15:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.