ziggy:generate doesn't worked with a cached routes file containing route closures - Function () does not exist error when running ziggy:generate
See original GitHub issueDescription
Running php artisan ziggy:generate
works on my local machine.
In production I get the following error: Function () does not exist {"exception":"[object] (ReflectionException(code: 0): Function () does not exist at
Function () does not exist {"exception":"[object] (ReflectionException(code: 0): Function () does not exist at /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/RouteSignatureParameters.php:23)
[stacktrace]
#0 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/RouteSignatureParameters.php(23): ReflectionFunction->__construct()
#1 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Route.php(507): Illuminate\\Routing\\RouteSignatureParameters::fromAction()
#2 /var/www/html/vendor/tightenco/ziggy/src/Ziggy.php(152): Illuminate\\Routing\\Route->signatureParameters()
#3 /var/www/html/vendor/tightenco/ziggy/src/Ziggy.php(94): Tightenco\\Ziggy\\Ziggy->resolveBindings()
#4 /var/www/html/vendor/tightenco/ziggy/src/Ziggy.php(25): Tightenco\\Ziggy\\Ziggy->nameKeyedRoutes()
#5 /var/www/html/vendor/tightenco/ziggy/src/CommandRouteGenerator.php(37): Tightenco\\Ziggy\\Ziggy->__construct()
#6 /var/www/html/vendor/tightenco/ziggy/src/CommandRouteGenerator.php(27): Tightenco\\Ziggy\\CommandRouteGenerator->generate()
#7 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Tightenco\\Ziggy\\CommandRouteGenerator->handle()
#8 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#9 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#10 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\\Container\\BoundMethod::callBoundMethod()
#11 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(596): Illuminate\\Container\\BoundMethod::call()
#12 /var/www/html/vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Illuminate\\Container\\Container->call()
#13 /var/www/html/vendor/symfony/console/Command/Command.php(258): Illuminate\\Console\\Command->execute()
#14 /var/www/html/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\\Component\\Console\\Command\\Command->run()
#15 /var/www/html/vendor/symfony/console/Application.php(920): Illuminate\\Console\\Command->run()
#16 /var/www/html/vendor/symfony/console/Application.php(266): Symfony\\Component\\Console\\Application->doRunCommand()
#17 /var/www/html/vendor/symfony/console/Application.php(142): Symfony\\Component\\Console\\Application->doRun()
#18 /var/www/html/vendor/laravel/framework/src/Illuminate/Console/Application.php(93): Symfony\\Component\\Console\\Application->run()
#19 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\\Console\\Application->run()
#20 /var/www/html/artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle()
#21 {main}
Expected behavior
I’d expect the Ziggy routes file to be generated as in production.
Environment
- Laravel version: v8.14.0
- Ziggy version: v1.0.2 Related routes:
Ziggy call and context:
php artisan ziggy:generate
As far as I’m aware there are no big differences between the production and my local environment. Any insight into what’s causing this error and how to go about debugging further would be appreciated, but by no means expected 😃
Issue Analytics
- State:
- Created 3 years ago
- Comments:7
Top Results From Across the Web
Laravel artisan route:cache causes Erroneous data Exception
It doesn't exist locally but is borked once it gets deployed on Vapor. I didn't have closures in my routes; and I get...
Read more >Laravel: route:cache not use files in subdirectories
php when I wrote main routes and in this directory I created subdirectory routes/groups. There I have several files separate by some categories....
Read more >"ip route show cached" doesn't work but man page says it does?
The main problem is that "man ip-route" keeps having multiple references to the cache table. * "cache - dump the routing cache." *...
Read more >Laravel route caching for improved performance - VOLTAGE
If your routes are not cached, $this->loadRoutes() ends up calling the app/Providers/RouteServiceProvider.php map() function which maps Api routes ( ...
Read more >workbox-routing - Chrome Developers
A service worker can intercept network requests for a page. It may respond to the browser with cached content, content from the network...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hey, I would like to add another example of the problem which was solved by correctly calling an invokable controller.
Did not work
Fixed it
I’m pretty sure this isn’t an issue with Ziggy, but please feel free to comment here again or open a new issue if you’re able to reproduce it!