Skip to content

[Webhook] WebhookController doesn't accept / character in the webhook path #50973

Closed
@BOB41K1987

Description

@BOB41K1987

Symfony version(s) affected

6.3.0

Description

Webhook routing with a / character in the path doesn't work. This is due to the Symfony router by default doesn't allow a / character in a route parameter

// config/webhook.php
<?php
declare(strict_types=1);

namespace Symfony\Component\DependencyInjection\Loader\Configurator;

use Symfony\Config\FrameworkConfig;

return static function (FrameworkConfig $framework): void {
    $webhookConfig = $framework
        ->webhook();

    $webhookConfig->routing('some-service/orders') // <-- notice `/` in the path
        ->service(SomeServiceOrderWebhookRequestParser::class)
        ->secret('some-secret');
};

How to reproduce

Install a new symfony/webhook component
Add a new webhook config with a / character in the route
The route won't match and return 404

Possible Solution

Apply the solution from the routing documentation when configuring WebhookController class

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