-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SQSClient receiveMessage JSON Parse error #2821
Comments
Hi @xto, sorry to hear about your issues. I am not sure what could be causing this at your end. I just tried to reproduce this but I was not able to. <?php
use Aws\Sqs\SqsClient;
require '../vendor/autoload.php';
$client = new SqsClient(['region' => 'us-east-2']);
$response = $client->receiveMessage([
'QueueUrl' => 'test-queue',
'MaxNumberOfMessages' => 1,
'WaitTimeSeconds' => 0
]);
print_r($response); Here is the response: Response
Could you please try to create new project from scratch and test it?, also, could you please make sure the SDK dependency is up to date?. I look forward to your response. Thanks! |
@xto, Also, could you could provide debug logs from the test by adding |
Hello, I believe this issue might be related to LocalStack, see localstack/localstack#8267 @xto this should now be fixed in the latest version of LocalStack, you can read about it in the linked issue. |
@bentsku thanks for the info. I'll report back on my issue after trying updating |
@xto, Sorry for the confusion. #2822 prompted an investigation on our side into how we were sending requests with |
@xto @stobrien89 Thanks guys. SQS is also fixing the |
@bentsku Thanks for fixing the LocalStack. |
I'm going to close this. Upgrading to the latest localstack version seems to have resolved the error. Thanks for the assist @bentsku @stobrien89 @yenfryherrerafeliz 🙇 |
|
Describe the bug
Calling
receiveMessage
on an instance of SqsClient throws an exception. We found this through a library upgrade triggered by Dependabot as it failed our CI. Here's the most minimal code to that triggers the exception.I did some digging and at https://github.com/aws/aws-sdk-php/blob/3.285.1/src/Api/Parser/PayloadParserTrait.php#L18,
$json
holds aGuzzleHttp\Psr7\Stream
object and callinggetContents
on that object revealed that it does not contain a JSON string but rather an XML string. This is the result ofdump($json->getContents())
:This issue was not present in 3.285.0
Expected Behavior
The expected behaviour is that the parser receives a JSON payload and parses it successfully
Current Behavior
An exception happens with the following message gets thrown:
Aws\Api\Parser\Exception\ParserException: Error parsing JSON: Syntax error
Reproduction Steps
Possible Solution
No response
Additional Information/Context
No response
SDK version used
3.285.1
Environment details (Version of PHP (
php -v
)? OS name and version, etc.)PHP 8.2.4
The text was updated successfully, but these errors were encountered: