Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I'm getting internal server error "or" endpoint request timed out using Laravel Vapor

I'm using Laravel Vapor for a project and I started getting this error today. It seems to happen randomly in different pages, it first take a minute trying to load and then I get one of this errors.

{"message": "Internal server error"}

{"message": "Endpoint request timed out"}

I'm not sure what the problem is since the error doesn’t show in my vapor-ui logs. Any idea what could be happening? Thanks

like image 313
Victor Avatar asked Jan 21 '26 23:01

Victor


1 Answers

Your code is likely timing out due to the timeout and possibly the memory configs on your vapor.yml. Since you're receiving a timeout vs. a 500 or similar error, you're not seeing errors in the logs.

To verify I'd inspect the network requests coming through your browser and when it 'randomly' fails, see if it's always stopping its execution at 10 seconds (or whatever your timeout is in your vapor.yml file). Assuming you're reaching your timeout, I'd suggest doing the following:

  1. Debug your code to understand why it's timing out and optimize any inefficiencies. Laravel Telescope provides some tooling for this: https://laravel.com/docs/8.x/telescope
  2. Increase the timeout config on your vapor.yml file (default is 10 seconds) - Vapor docs: https://docs.vapor.build/1.0/projects/environments.html#timeout
  3. Increase the memory config in your vapor.yml file (default is 1024). Per the docs: Vapor (via AWS Lambda) allocates CPU power to your Lambda function in proportion to the amount of memory configured for the application.. Vapor docs: https://docs.vapor.build/1.0/projects/environments.html#memory
  4. Review the other performance tips Vapor provides: https://docs.vapor.build/1.0/projects/troubleshooting.html#performance-issues
like image 88
tbone1000 Avatar answered Jan 25 '26 00:01

tbone1000