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

Essam's avatar
Level 4

Laravel Vapor 504 Gateway Timeout

Hello

I'm facing an issue with my application, I'm using laravel vapor with the following configuration

    warm: 10
    memory: 2048
    cli-memory: 512
    timeout: 300
    runtime: php-7.4

I set the timeout to 5 minutes but all request that executes in more than 30 seconds is failing with error 504 Gateway Timeout

hope you could help me fix that

0 likes
6 replies
Taelkir's avatar

I get this too - Cloudflare 504 error after a short while despite setting

timeout: 180

In my vapor.yml file

Taelkir's avatar
Taelkir
Best Answer
Level 3

Received this reply from Vapor support when I asked:

There are hard limits set by AWS on requests. You need to switch to using queued jobs for tasks that require more than 30 seconds.

1 like
itsmedave's avatar

This a gateway vs balancer decision.

By default Vapor uses AWS API Gateway version 1 that has a 30 seconds timeout for any request. Then you have Gateway version 2 that has the same timeout but is faster in processing. The 30 seconds are defined by AWS as part of the product characteristics.

And finally you have ALB (Application Load Balancer) that has up to 4.000 seconds. There's also a catch related to maximum body size.

  • API Gateway v1
    • timeout 30 seconds
    • maximum body size 6 mb
  • API Gateway v2 (faster than v1)
    • timeout 30 seconds
    • maximum body size 6 mb
  • ALB
    • timeout 4000 seconds
    • maximum body size 1 mb

All of this limitations are characteristics of AWS products, to my knowledge they are not related with Vapor.

Finally these articles should help you make a decision:

3 likes

Please or to participate in this conversation.