Skip to content

bb-email-client: a subject containing CR/LF is sent locally, rejected with InvalidInputException on AWS #1278

Closed

Description

@belaboe

Before opening, please confirm

  • I have searched for duplicate or closed issues.
  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.

Which package(s) are affected?

Other (@aws-blocks/bb-email-client)

Describe the bug

send() with a subject that contains a line break (for example a subject built from user input, or one that ends in \r\n) succeeds locally: the mock logs the message and returns a messageId. On AWS, SES rejects it and the block throws InvalidInputException. The mock validates addresses and the recipient count but not the subject.

Call Local Deployed
send({ to, subject: 'Hello\r\nWorld', body }) ok InvalidInputException

Since a subject is often built from form input (Order from ${name}), this is a path that works in development and fails in production for some users only.

Expected behavior

The mock rejects subjects containing CR or LF with the same InvalidInputException (or both layers strip or reject them consistently, and the README says which).

Reproduction steps

const email = new EmailClient(scope, 'mail', { fromAddress: 'noreply@example.com' });
await email.send({
  to: ['success@simulator.amazonses.com'],
  subject: 'Hello\r\nWorld',
  body: 'Hi',
}); // ok locally, InvalidInputException deployed

Environment

  • @aws-blocks/* 0.8.0 (main at 34e758c)
  • Local: npm run dev dev server, Node 22, macOS
  • Deployed: a sandbox stack in us-east-1

Additional context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions