symfony-docker icon indicating copy to clipboard operation
symfony-docker copied to clipboard

Mercure transport is not configurable since FrankenPHP v1.10

Open 7-zete-7 opened this issue 1 month ago • 1 comments

Since Mercure v0.21, it's now possible to disable deprecated transport behavior (or rather, enable it with the deprecated_transport flag) (see https://github.com/dunglas/mercure/pull/1105). By default, Mercure is built with this flag.

FrankenPHP is built without the deprecated_transport flag. This causes the MERCURE_TRANSPORT_URL env to be ignored. The default transport is bolt:///bolt.db.

This behavior shouldn't affect most users. However, there are exceptions:

  • Those who used the MERCURE_TRANSPORT_URL environment variable may find that its value has no effect.

  • When running as an unprivileged user, the following container startup error will occur:

    Error: loading initial config: loading new config: loading frankenphp app module: provision frankenphp: failed to provision caddy http: loading http app module: provision http: server srv0: setting up route handlers: route 0: loading handler modules: position 0: loading module 'subroute': provision http.handlers.subroute: setting up subroutes: route 2: loading handler modules: position 2: loading module 'mercure': provision http.handlers.mercure: provision http.handlers.mercure.bolt: "": invalid transport: open bolt.db: permission denied
    

I see solutions to this problem:

  • Stop using the MERCURE_TRANSPORT_URL env and start using the mercure.transport directive (see https://github.com/dunglas/mercure/blob/c7cf56e647e87aa814331e5ebf6672cae1ed2a54/docs/UPGRADE.md#017)
  • Add the deprecated_transport flag when building FrankenPHP
  • Make the deprecated Mercure transport behavior the default

I suggest the first option.

@dunglas @maxhelias

7-zete-7 avatar Nov 26 '25 10:11 7-zete-7

First option is definitely the best!

dunglas avatar Nov 26 '25 11:11 dunglas