Why did you delete the APP_KEY. Laravel needs it for security reasons.
Run php artisan key:generate to generate a new one.
Nov 24, 2019
2
Level 1
Double Response On RuntimeException No application encryption key
i received double responses when i remove my application key and ran the application, follow these steps to replicate the bug
composer create-project laravel/laravel "project-name"
cd project-name
nano .env
Delete the application key if any has been set
APP_KEY=
save the .env file go to the Handler.php file and add the following
cd App\Exceptions
nano Handler.php
Add the following to the render function
/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $exception
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $exception)
{
// Thrown when an exception occurs.
if ($exception instanceof Exception) {
return response()->json('okay', 500);
}
return parent::render($request, $exception);
}
Then run on your browser visit http://127.0.0.1:8000/ or http://serving_address/ You should receive two json response instead of one
My question, is this a bug? should i not return json response from the handler? how do i fix this?
Please or to participate in this conversation.