Skip to content

Undefined array key Message symfony/postmark-mailer #60297

Open
@turbo124

Description

@turbo124

Symfony version(s) affected

^7

Description

If an email contains attachments > postmark threshold, postmark will return an error with the following payload:

array (
  'message' => 'Request size limit exceeded',
  'request_id' => 'xxxx',
)  

Status Code = 413
However according to this line here:

https://github.com/symfony/postmark-mailer/blob/d11c8ce0ff5974a2ee4a9a3297ba89ecdf6d1952/Transport/PostmarkApiTransport.php#L86

The error message is expecting the key to be Capitalized, causing the error descibed above "Undefined array key 'Message'"

How to reproduce

Add attachments > postmark threshold to an email
Attempt to send
error, Undefined array key 'Message'

Possible Solution

It appears the symfony mailer is expecting API Error codes and the response to always be formatted with

["ErrorCode", "Message"]

However if the response is a Http error code, the payload may not be in this format.

A suggested approach here would be to create a block just for 413 HTTP errors, and return the response based on the output above with the 'message' key

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions