gpt4 book ai didi

laravel - AWS SQS 异常 "413 Request Entity Too Large"

转载 作者:行者123 更新时间:2023-12-05 09:06:17 30 4
gpt4 key购买 nike

我已经被困了一段时间以弄清楚以下异常,任何帮助都会被拒绝。我们在 Laravel 项目上使用 AWS Lambda 服务。我们正在使用 Laravel Excel 将大量数据导出到 CSV 文件我们正在通过 Laravel SQS 队列来做到这一点。

PHP 版本:7.2
Laravel 框架:7.30.1
Laravel Excel:3.1

异常(exception):

Aws\Sqs\Exception\SqsException /tmp/vendor/aws/aws-sdk-php...
stage.ERROR: Error executing "SendMessage" on "https://sqs.eu-central-
1.amazonaws.com"; AWS HTTP error: Client error: `POST https://sqs.eu-
central-1.amazonaws.com/` resulted in a `413 Request Entity Too Large`
response:
HTTP content length exceeded 1662976 bytes.
Unable to parse error information from response - Error parsing XML: String could not be parsed as
XML {"exception":"[object] (Aws\\Sqs\\Exception\\SqsException(code: 0): Error executing
\"SendMessage\" on \"https://sqs.eu-central-1.amazonaws.com/"; AWS
HTTP error: Client error: `POST https://sqs.eu-central-1.amazonaws.com/` resulted in a `413 Request Entity Too Large` response:
HTTP content length exceeded 1662976 bytes.
Unable to parse error information from response - Error parsing XML: String could not be parsed as
XML at /tmp/vendor/aws/aws-sdk-php/src/WrappedHttpHandler.php:195)
[stacktrace]

最佳答案

来自docs :

Message size
The minimum message size is 1 byte (1 character). The maximum is 262,144 bytes (256 KB).

我的猜测是您尝试发送的文件大于 256KB,这是 AWS 中 SQS 消息的硬性限制。

输出 HTTP content length exceeded 1662976 bytes 表明我的猜测可能是正确的。

这种情况下的常见模式是将文件上传到 S3 并通过队列发送对对象的引用。

关于laravel - AWS SQS 异常 "413 Request Entity Too Large",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66171992/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com