Skip to content

Unable to access request actor in error handler #1847

@dsevillamartin

Description

@dsevillamartin

Introduced in #1843 which introduces an alternative instead of middleware for error handling.

The "problem" here is that PSR-7 requests and responses are immutable. The ErrorHandler middleware basically passes on the request it received from the outside world to inner middleware. One of these middlewares extracts cookies, headers etc. from the response to determine the actor, which is then stored as a "request attribute" on the request. Once you add a new request attribute, you're creating a new request instance, though - which means the request instance known by the ErrorHandler is unchanged. This was a design decision when PSR-7 was created.

TL;DR: Request object passed to error handler is not the same instance as the one passed to middleware. Actor is unavailable.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions