Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serialization of Closure Not Allowed #1

Open
zlanich opened this issue Oct 14, 2018 · 6 comments
Open

Serialization of Closure Not Allowed #1

zlanich opened this issue Oct 14, 2018 · 6 comments

Comments

@zlanich
Copy link

zlanich commented Oct 14, 2018

After upgrading to Laravel 5.7, I'm getting a Serialization of Closure not allowed on a ton of my requests. The error went away when I disabled this middleware. Help!

@zlanich
Copy link
Author

zlanich commented Oct 14, 2018

More details, it only seems to occur in my Redis Store. Here's a full stack trace: https://sentry.io/share/issue/9b7f938e4bb6410f9ae6d5c2bbddae46/

@javidalpe
Copy link
Owner

Following the issue, did you resolve the issue? I've tried it on Laravel 5.7 and Laravel 5.8 with no problems. Seems like you have something attached to the response object that cannot be serialized.

@zlanich
Copy link
Author

zlanich commented Mar 16, 2019

@javidalpe I haven't been able to resolve this yet because it's a really intermittent issue that occurs in the production environment with a decent volume of requests, so I haven't been able to reproduce it and I can't leave the prod env broken. I'm not sure of the best way to go about debugging it yet.

@karunkshrestha
Copy link

$response = $next($request);
$response->header(self::IDEMPOTENCY_HEADER, $requestId);
Cache::put($requestId, $response, self::EXPIRATION_IN_MINUTES);

In my case I have found that if $response is of type Illuminate\Http\Response, Cache is able to serialise and save it. However if $response is of type Illuminate\Http\JsonResponse I get the Serialization of closure is not allowed error message.

I don't any work around for it. any suggestions?

@simioluwatomi
Copy link

For any one still having the issue, this works fine for me

        Cache::put($requestId, [
            "response" => $response->getContent(),
            "path" => $request->path(),
            "status" => $response->status()
        ], now()->addMinutes(self::EXPIRATION_IN_MINUTES));

@AbdullahiAbdulkabir
Copy link

Screenshot 2022-04-27 at 11 13 52 AM

this issue still persist. It kinda conflicting with my request validation. @javidalpe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants