> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://doc.common-services.com/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# Gateway Timeout (504 error) during cron execution - Amazon Marketplace Plus

A Gateway Timeout (504) error occurs when the server takes too long to respond and the request is terminated.

This is usually related to server limits (PHP or web server configuration), not a module bug.

---

## Why this happens

This issue typically occurs when:

* the cron process is too heavy (catalog, stock, orders)
* the server cannot complete execution within allowed time
* PHP or server timeout limits are too low

---

## Solution 1: Increase PHP execution time

You can increase the PHP execution limit in your server configuration:

PHP setting:
max_execution_time = 300 to 600 seconds

Recommended values:
* 300 seconds minimum
* 600 seconds for large catalogs or full synchronizations

---

## Solution 2: Use CLI execution (recommended)

The best solution is to run the cron using PHP CLI instead of HTTP.

This avoids:
* web server timeout limits
* 504 Gateway Timeout errors
* proxy or firewall interruptions

---

## HTTP version (for reference only)

Use the standard cron URL provided by the module (HTTP call via browser or crontab).

---

## CLI version (recommended)

Your server provider should use a command like:

/usr/bin/php /path/to/prestashop/modules/amazonsaas/functions/report_listing_inventory.php cron_token=XXXX mkp=XXXX

---

## Important notes

Please ask your hosting provider to:

* increase PHP execution time limit (300–600 seconds)
* or switch cron execution to PHP CLI
* ensure correct absolute path to PrestaShop
* verify PHP CLI binary path (/usr/bin/php or equivalent)

---

## Recommendation

For large catalogs or heavy synchronizations, CLI execution is strongly recommended as it fully avoids HTTP limitations and timeout issues.