Hello,
Listening to Symfony Messenger workers raises a BadRequestException from Symfony\Component\HttpFoundation\Request.
It seems to be due to the introduction of a rejection of some characters in the URIs, including backslashes, by the Request class of the HTTPFoundation component:
symfony/http-foundation@32310ff#diff-de5d8eb3f1d6537c947f70e0a4673779312a902c083739f472c709c037bcbc30R370
if (false !== ($i = strpos($uri, '\\')) && $i < strcspn($uri, '?#')) {
throw new BadRequestException('Invalid URI: A URI cannot contain a backslash.');
}
Backslashes are used by the bundle in the transaction name, which is composed from the class name of the message, and the class name uses backslashes for the namespace:
|
$transactionName = \get_class($event->getEnvelope()->getMessage()); |
|
$transactionName = \get_class($envelope->getMessage()); |
Then the SymfonyProfiler uses the transaction name in the URI:
|
$uri = sprintf('http://%s/%s', $kind, $name); |
And creates the Request:
|
$this->request = Request::create($uri, $kind); |
I suggest fixing it by replacing the backslashes in the class name with regular slashes:
$transactionName = str_replace('\\', '/', \get_class($event->getEnvelope()->getMessage()));
$transactionName = str_replace('\\', '/', \get_class($envelope->getMessage()));
Hello,
Listening to Symfony Messenger workers raises a
BadRequestExceptionfromSymfony\Component\HttpFoundation\Request.It seems to be due to the introduction of a rejection of some characters in the URIs, including backslashes, by the Request class of the HTTPFoundation component:
symfony/http-foundation@32310ff#diff-de5d8eb3f1d6537c947f70e0a4673779312a902c083739f472c709c037bcbc30R370
Backslashes are used by the bundle in the transaction name, which is composed from the class name of the message, and the class name uses backslashes for the namespace:
instrumentation/src/EventListener/MessengerProfilerListener.php
Line 37 in e33e7be
instrumentation/src/Messenger/ProfilerMiddleware.php
Line 32 in e33e7be
Then the
SymfonyProfileruses the transaction name in the URI:instrumentation/src/Profiler/SymfonyProfiler.php
Line 48 in e33e7be
And creates the Request:
instrumentation/src/Profiler/SymfonyProfiler.php
Line 50 in e33e7be
I suggest fixing it by replacing the backslashes in the class name with regular slashes: