Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

eshban's avatar

Unable to prepare Route for Serialization

I have installed PDF package and do some updates on Composer on my server due to that one of my route is not working which is :

For troubleshooting I ran the following command:

 php artisan route:cache -v

It shows me bunch of errors:

  LogicException  : Unable to prepare route [api/user] for serialization. Uses Closure.

  at /home/customer/www/dornew.deas-software.com/public_html/vendor/laravel/framework/src/Illuminate/Routing/Route.php:917
    913|      */
    914|     public function prepareForSerialization()
    915|     {
    916|         if ($this->action['uses'] instanceof Closure) {
  > 917|             throw new LogicException("Unable to prepare route [{$this->uri}] for serialization. Uses Closure.");
    918|         }
    919|
    920|         $this->compileRoute();
    921|


How to fix this issue? Any suggestions please?

Thanks

0 likes
1 reply

Please or to participate in this conversation.