ReplicaSet mongodb causing issues

I have…

I’m submitting a…

  • Regression (a behavior that stopped working in a new release)
  • [X ] Bug report
  • Performance issue
  • Documentation issue or request

Current behavior

When creating a content item that has an image asset (via API), the POST request works as expected; however, I changed the mongodb deployment to run as a replicaset (single node), and the squidex API request times out. Interestingly enough, if I comment out the image ID from being created (or updated), the API request works as expected, but the minute I have an asset ID (which is valid and works via front-end to assign to content item) within the content request, the API returns a 500 error and the below error shows within the logs. Is there something I need to change for squidex to work with the replicaset?

development-squidex-1  |     "message": "A timeout occurred after 30000ms selecting a server using CompositeServerSelector{ Selectors = ReadPreferenceServerSelector{ ReadPreference = { Mode : Secondary } }, LatencyLimitingServerSelector{ AllowedLatencyRange = 00:00:00.0150000 }, OperationsCountServerSelector }. Client view of cluster state is { ClusterId : \u00221\u0022, ConnectionMode : \u0022ReplicaSet\u0022, Type : \u0022ReplicaSet\u0022, State : \u0022Connected\u0022, Servers : [{ ServerId: \u0022{ ClusterId : 1, EndPoint : \u0022Unspecified/host.docker.internal:27017\u0022 }\u0022, EndPoint: \u0022Unspecified/host.docker.internal:27017\u0022, ReasonChanged: \u0022Heartbeat\u0022, State: \u0022Connected\u0022, ServerVersion: 6.0.0, TopologyVersion: { \u0022processId\u0022 : ObjectId(\u0022658f348512e5c37a483e20d6\u0022), \u0022counter\u0022 : NumberLong(6) }, Type: \u0022ReplicaSetPrimary\u0022, WireVersionRange: \u0022[0, 17]\u0022, ElectionId: \u00227fffffff0000000000000005\u0022, LastHeartbeatTimestamp: \u00222023-12-29T21:18:12.4997162Z\u0022, LastUpdateTimestamp: \u00222023-12-29T21:18:12.4997193Z\u0022 }] }."

Here is my docker-compose for the relica setup:

    image: mongo
    command: ["--replSet", "rs0", "--bind_ip_all", "--port", "27017"]
      - 27017:27017
      - "host.docker.internal:host-gateway"
      test: echo "try { rs.status() } catch (err) { rs.initiate({_id:'rs0',members:[{_id:0,host:'host.docker.internal:27017'}]}) }" | mongosh --port 27017 --quiet
      interval: 5s
      timeout: 30s
      # start_period: 0s
      # start_interval: 1s
      retries: 30
      - ./data/mongodb:/data/db
      - "mongo_config:/data/configdb"

Expected behavior

Associating a content item with an existing asset ID works regardless of replicaset mongodb setup or not.

Minimal reproduction of the problem

Use the above docker-compose configuration as a back-end data store for squidex, and create a content item that has an image asset field. Create that content item via API with an asset ID of an already uploaded image, and you’ll see the issue.


  • [ X] Self hosted with docker
  • Self hosted with IIS
  • Self hosted with other version
  • Cloud version

Version: 7.0


  • Chrome (desktop)
  • Chrome (Android)
  • Chrome (iOS)
  • Firefox
  • Safari (desktop)
  • Safari (iOS)
  • IE
  • Edge


As a side note on this… I tried increasing the replica count to 2, and the above issue doesn’t happen anymore. It may be good to update the documentation on this for the mongodb config (I may have missed it if it’s already there though…)