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

mellunar's avatar

API only routes not working

I followed this tutorial to deploy a Laravel 10 API to Vercel: dev.to/kenean50/free-serverless-laravel-deployment-1e9n

Everything works fine while running in localhost, but when I try to request any API route from the deploy, I get the error "The route could not be found". This also happens even if I remove all web routes from "routes/web.php" and from RouteServiceProvider.

As I have an Angular application on my main domain, I don't need the web routes from Laravel, so I registered a subdomain and set it as the app URL in Laravel env. I was trying to make this work, but I get a 500 error from this: laracasts.com/discuss/channels/laravel/how-to-implement-laravel-api-on-subdomain?reply=793213

Any ideas?

0 likes
2 replies
martinbean's avatar

@mellunar If you get a 500 error then you need to check your Laravel error log, as that’s almost always from an exception being thrown.

mellunar's avatar

I found out the issue. It was a misconfiguration from the Vercel.json file of the tutorial.

Please or to participate in this conversation.