Before render page: "Something went wrong!"

Hi

Could someone help me with the following problem?

Perform an installation from the Laravel 10 wizard, new project, after installation and configuration and running the new application the message appears

Something went wrong!

Message: We can’t process the response of the server.

Error:
Error: unknown status.
Server Response:
The server returned an empty response (e.g. a blank page).

In console:

After close message, works fine

I have:

-Windows 11
-Apache 2.4
-Laravel 10
-GC 3.0.16
-PHP 8.3 (Same with 8.2)
-PostgreSQL 16

Thanks

Hello @NOLO ,

This is an issue with the CSRF token. There has been reports from other users as well, however I can’t reproduce it locally. Can I ask you if you have anything special in your project (e.g. custom session storage… e.t.c.) ?

Just to make sure, have you added the below code at your function?

        $crud->setCsrfTokenName('_token');
        $crud->setCsrfTokenValue(csrf_token());

And also have you added the special tag in your html header like this?

<meta name="csrf-token" content="{{ csrf_token() }}">

Let me know if any of the above worked and if not, if you can provide me more details that would be very helpful.

Regards
Johnny

Controller:

<?php namespace App\Http\Controllers; use GroceryCrud\Core\GroceryCrud; class CustomersController extends Controller { public function index() { // } private function _getDatabaseConnection() { return [ 'adapter' => [ 'driver' => 'Pdo_Pgsql', 'database' => 'encuestas', 'username' => 'postgres', 'password' => 'postgres', 'charset' => 'utf8' ] ]; } public function datagrid() { $database = $this->_getDatabaseConnection(); $config = config('grocerycrud'); $crud = new GroceryCrud($config, $database); $crud->setTable('bancos'); $crud->setSubject('Bancos','Administración de Bancos'); $crud->columns(['banco_id','banco']); $crud->unsetDelete(); $crud->unsetDeleteMultiple(); $crud->setCsrfTokenName('_token'); $crud->setCsrfTokenValue(csrf_token()); $output = $crud->render(); if ($output->isJSONResponse) { header('Content-Type: application/json; charset=utf-8'); echo $output->output; exit; } $js_files = $output->js_files; $output = $output->output; return view('default_template', [ 'output' => $output, 'js_files' => $js_files ]); } } default template: Example
{!! $output !!}
@foreach ($js_files as $js_file) @endforeach

Hello @NOLO,

I just wanted to inform you that I can finally reproduce the issue. I will investigate and keep you updated once I have a solution.

Regards
Johnny

1 Like

Hello @NOLO and happy new year :hugs:

I am glad to inform you that this issue is finally fixed. It was a tough one because I couldn’t reproduce it so thank you for your detailed bug report and taking the time to install everything from scratch so you can reproduce it.

You can download the latest version 3.0.19 from the wizard: Grocery CRUD Enterprise Installation Wizard

Regards
Johnny

Johnny, Thank you very much for your work and effort, and HAPPY NEW YEAR!!!

1 Like