amazon-connect / amazon-connect-chatjs

Amazon Connect ChatJS - a browser-based contact center integration API for Chat on the Agent and Customer side.
https://docs.aws.amazon.com/connect/latest/adminguide/what-is-amazon-connect.html
Apache License 2.0
93 stars 54 forks source link

Send attachment throw error that signature does not match #188

Closed SaqibOctave closed 1 year ago

SaqibOctave commented 1 year ago

Hi All, I try to invoke the sendAttachment method of the streams API, but when i pass the Attachment to Send Attachment API it through an error that signtaure does not match

controller.sendAttachment({
                    attachment: file
                  }).then((res)=>{
                    console.log(res);
                  })

the First API runs successfully like this image and the response of the start-attachment-upload API is exact match like in the documentation

{
    "AttachmentId": "a9ac98ec-c936-4441-a124-9d7a88debfce",
    "UploadMetadata": {
        "HeadersToInclude": {
            "x-amz-meta-contact_id": "3dff5a86-2f3a-4bf3-aa47-d82871671096",
            "x-amz-meta-initial_contact_id": "3dff5a86-2f3a-4bf3-aa47-d82871671096",
            "x-amz-acl": "bucket-owner-full-control",
            "Content-Disposition": "attachment; filename=\"56102_file.txt\"",
            "x-amz-meta-account_id": "747926693930",
            "Content-Length": "9",
            "Content-Type": "text/plain",
            "x-amz-meta-organization_id": "84ecefa9-184a-400f-babf-3288d7c8fd04"
        },
        "Url": "URL",
        "UrlExpiry": "2023-08-03T08:15:46Z"
    }
}

but when it goes to complete attachment upload part it gives the error: image

mhiaror commented 1 year ago

SaqibOctave I tried out the sendAttachment API call, it seems to be working for me. Its a 3 step process:

  1. Call start-attachmend-upload - this works for you based on screenshot you attached.
  2. Call s3 pre-signed URL to upload the attachment -- I see from screenshot you attached - this is failing! Can you please follow the documentation here https://docs.aws.amazon.com/connect/latest/adminguide/enable-attachments.html to make sure your S3 bucket is configured correctly to enable attachments support.

Also, you can navigate to your AdminWebsite console test-chat page to test attachments after updating S3 configurations. https://<instance name>.my.connect.aws/test-chat https://docs.aws.amazon.com/connect/latest/adminguide/add-chat-to-website.html