Skip to content
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

The example of SendRawEmailCommand does not match the docs so the example fails if you try to replicate #4800

Closed
LucasGarci opened this issue Jun 7, 2023 · 3 comments
Assignees
Labels
closed-for-staleness documentation This is a problem with documentation. p2 This is a standard priority issue queued This issues is on the AWS team's backlog

Comments

@LucasGarci
Copy link

LucasGarci commented Jun 7, 2023

Describe the issue

The example shows no base64 encoding

// The following example sends an email with an attachment:
const input = {
  "Destinations": [],
  "FromArn": "",
  "RawMessage": {
    "Data": "From: [email protected]\\nTo: [email protected]\\nSubject: Test email (contains an attachment)\\nMIME-Version: 1.0\\nContent-type: Multipart/Mixed; boundary=\"NextPart\"\\n\\n--NextPart\\nContent-Type: text/plain\\n\\nThis is the message body.\\n\\n--NextPart\\nContent-Type: text/plain;\\nContent-Disposition: attachment; filename=\"attachment.txt\"\\n\\nThis is the text in the attachment.\\n\\n--NextPart--"
  },
  "ReturnPathArn": "",
  "Source": "",
  "SourceArn": ""
};
const command = new SendRawEmailCommand(input);
const response = await client.send(command);
/* response ==
{
  "MessageId": "EXAMPLEf3f73d99b-c63fb06f-d263-41f8-a0fb-d0dc67d56c07-000000"
}
*\/
// example id: sendrawemail-1469118548649

But the docs especifies that it need to be base64 encoded

image

Links

https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/preview/client/ses/command/SendRawEmailCommand/

@LucasGarci LucasGarci added documentation This is a problem with documentation. needs-triage This issue or PR still needs to be triaged. labels Jun 7, 2023
@RanVaknin RanVaknin self-assigned this Jun 13, 2023
@kuhe
Copy link
Contributor

kuhe commented Jun 13, 2023

RawMessage.Data is declared as a blob type, and the current JSv3 implementation is to require a Uint8Array for blob type inputs that are not modified (i.e. type-widened) by the streaming trait, which does not apply in this case.

Using the example as-is may cause a type error when a string instead of a Uint8Array is provided. As part of ongoing work to simplify type conversions for Blobs in #4265, we will try to cover the case where a Uint8Array blob representation is currently required but the user supplies a string. We will aim to add automatic conversion in these cases.

@RanVaknin RanVaknin added p2 This is a standard priority issue queued This issues is on the AWS team's backlog and removed needs-triage This issue or PR still needs to be triaged. labels Jun 14, 2023
@kuhe
Copy link
Contributor

kuhe commented Sep 21, 2023

The docs mention base64 encoding, but this is something that the AWS SDKs do for you, if you provide the expected Uint8Array.

@kuhe kuhe added the closing-soon This issue will automatically close in 4 days unless further comments are made. label Sep 21, 2023
@github-actions github-actions bot added closed-for-staleness and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Sep 26, 2023
@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
closed-for-staleness documentation This is a problem with documentation. p2 This is a standard priority issue queued This issues is on the AWS team's backlog
Projects
None yet
Development

No branches or pull requests

3 participants