Closed viJay-beep-code closed 1 year ago
Hi @viJay-beep-code - I'm working on reproducing this issue. I don't see anything out of the ordinary - is your JSON payload only ASCII characters? Could you try with utf8.encode(json.encode(payload))
if not?
Hello @dnys1 , thanks for your time.
My current payload is only ASCII. I also tried your suggestion on using utf8.encode(json.encode(payload))
, but result is same error.
Here is the curl request from firefox browser
curl 'https://<.....>' -X POST -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:105.0) Gecko/20100101 Firefox/105.0' -H 'Accept: */*' -H 'Accept-Language: en-US,en;q=0.5' -H 'Accept-Encoding: gzip, deflate, br' -H 'Referer: http://localhost:55804/' -H 'Content-Type: application/json;charset=utf-8' -H 'X-Amz-Date: 20221019T095205Z' -H 'X-Amz-Content-Sha256: {.....}' -H 'X-Amz-User-Agent: aws-sigv4-dart/0.2.2' -H 'Authorization: AWS4-HMAC-SHA256 Credential={......}, SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date;x-amz-user-agent, Signature={....}' -H 'Origin: http://localhost:55804' -H 'Connection: keep-alive' -H 'Sec-Fetch-Dest: empty' -H 'Sec-Fetch-Mode: cors' -H 'Sec-Fetch-Site: cross-site' -H 'TE: trailers' --data-raw '[object ReadableStream]'
And here is response header
HTTP/2 403 Forbidden
content-type: application/json
content-length: 843
date: Wed, 19 Oct 2022 09:52:06 GMT
x-amzn-requestid: e265d020-53c8-48e1-a4f5-652b99a4c9c3
access-control-allow-origin: *
access-control-allow-headers: Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token,X-Amz-Content-SHA256,X-Amz-User-Agent
x-amzn-errortype: InvalidSignatureException
x-amz-apigw-id: {......}
access-control-allow-methods: DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT
x-cache: Error from cloudfront
via: 1.1 e44070691669fda7111d97fca7fa71ea.cloudfront.net (CloudFront)
x-amz-cf-pop: DEL51-P3
x-amz-cf-id: {.......}
Thank you for the additional info. Can I ask which version of Firefox you're using?
version is 105 (must be latest) I installed it few days back no addons
Thank you. In your curl request, I see --data-raw '[object ReadableStream]'
but this is obviously not correct - can you confirm that in Firefox, the actual bytes are being sent in the request body?
This is the sample json payload that I am sending in the request body
{
"data":[
{
"id":"String",
"number":"String",
"name":"john"
},
........
],
"id":"String",
"org":"String",
"object":"String",
"name":"String",
"source": int
........
}
How to check for the bytes in browser? Plugin accepts body type as List--compressed
but it's working fine.
curl 'https://<.....>' \
-X 'POST' \
-H 'authority: ......amazonaws.com' \
-H 'accept: */*' \
-H 'accept-language: en-GB,en-US;q=0.9,en;q=0.8' \
-H 'authorization: AWS4-HMAC-SHA256 Credential={........}, SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date;x-amz-user-agent, Signature={........}' \
-H 'content-type: application/json;charset=utf-8' \
-H 'origin: .........' \
-H 'referer: ...........' \
-H 'sec-ch-ua: "Chromium";v="106", "Google Chrome";v="106", "Not;A=Brand";v="99"' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'sec-ch-ua-platform: "macOS"' \
-H 'sec-fetch-dest: empty' \
-H 'sec-fetch-mode: cors' \
-H 'sec-fetch-site: cross-site' \
-H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36' \
-H 'x-amz-content-sha256: {.........}' \
-H 'x-amz-date: 20221020T044004Z' \
-H 'x-amz-user-agent: aws-sigv4-dart/0.2.2' \
--compressed
Thank you for the additional information, @viJay-beep-code. I will do some more investigation on my end.
Hi @viJay-beep-code, I apologize for the delayed response on this issue. Are you still facing this issue? I have tried several different ways, but haven't been able to reproduce it yet.
Closing for now. Please reopen if you continue to face this issue.
Description
I am using 'aws_signature_v4' plugin with following code to connect AWS REST API using IAM authentication. It's working fine on Google Chrome but giving errors in Firefox.
Error:
Categories
Steps to Reproduce
No response
Screenshots
No response
Platforms
Android Device/Emulator API Level
No response
Environment
Dependencies
Device
MacBook
OS
macOS 12.3
Deployment Method
Amplify CLI + Custom Pipeline
CLI Version
No response
Additional Context
No response
Amplify Config
{}