Skip to content
Latchkey

Symfony Messenger "transport ... not found" / connection in CI

Messenger could not resolve or connect a transport. Either the named transport is not defined, its MESSENGER_TRANSPORT_DSN env var is missing, or the DSN points at a broker (AMQP, Redis, Doctrine) the CI job cannot reach.

What this error means

A messenger command or test fails with "The transport \"async\" was not found." or a connection exception from the transport factory when consuming or dispatching.

Symfony
Symfony\Component\Messenger\Exception\InvalidArgumentException:
  The transport "async" was not found. Available transports are "sync".

Common causes

The transport DSN env var is not set in CI

Messenger config reads %env(MESSENGER_TRANSPORT_DSN)%. If it is unset in the test env, the transport cannot be built or the config resolves to nothing.

The DSN points at an unreachable broker

In CI the AMQP/Redis broker may not be running as a service, so connecting the transport fails.

How to fix it

Use a synchronous or in-memory transport in tests

For most CI test runs, route messages to sync:// or the in-memory transport so no external broker is needed.

config/packages/messenger.yaml
# config/packages/messenger.yaml (when@test)
when@test:
  framework:
    messenger:
      transports:
        async: 'in-memory://'

Provide the DSN and a broker service if you must integration-test it

Set MESSENGER_TRANSPORT_DSN and start the broker as a service container so the transport connects.

.github/workflows/ci.yml
env:
  MESSENGER_TRANSPORT_DSN: "redis://127.0.0.1:6379/messages"

How to prevent it

  • Route messenger transports to in-memory/sync in the test environment.
  • Set MESSENGER_TRANSPORT_DSN explicitly when integration-testing a broker.
  • Start any required broker as a service container with a health check.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →