4

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

Victor
  • 133
  • 1
  • 6

3 Answers3

1

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
tbone1000
  • 1,000
  • 6
  • 4
-1

Check your memory and timeout is increased.

Jamie Ross
  • 246
  • 1
  • 3
  • 13
-3

I have had this problem often.

For this, I recommend you to examine the log file under storage/logs

Your query is probably timing out because the memory limit to php ini file is 128M. It will be fixed if you set the memory limit to 1024M in php ini file.

egg:

memory_limit =1024
Yunus Kocabay
  • 133
  • 10