Getting started example is not working

Hi,

I’m just starting to explore EventStore. So I started with the “Getting Started” section of course.
However, tying out the provided examples locally does not work.

EventStore is running in docker with the following docker-compose file:

version: '3.7'

services:
  eventstore.db:
    image: eventstore/eventstore:21.6.0-buster-slim
    environment:
      - EVENTSTORE_CLUSTER_SIZE=1
      - EVENTSTORE_RUN_PROJECTIONS=All
      - EVENTSTORE_START_STANDARD_PROJECTIONS=true
      - EVENTSTORE_EXT_TCP_PORT=1113
      - EVENTSTORE_HTTP_PORT=2113
      - EVENTSTORE_INSECURE=true
      - EVENTSTORE_ENABLE_EXTERNAL_TCP=true
      - EVENTSTORE_ENABLE_ATOM_PUB_OVER_HTTP=true
      - EVENTSTORE_INT_TCP_HEARTBEAT_INTERVAL=5000
      - EVENTSTORE_INT_TCP_HEARTBEAT_TIMEOUT=5000
      - EVENTSTORE_EXT_TCP_HEARTBEAT_INTERVAL=5000
      - EVENTSTORE_EXT_TCP_HEARTBEAT_TIMEOUT=5000
    ports:
      - "1113:1113"
      - "2113:2113"

Running the code below gives an exception with message “Connection ‘ES-04cc0e80-d2f2-4738-b0c7-19810ef7dd95’ was closed.” when calling conn.AppendToStreamAsync(...). Searching for this exception points towards heartbeat timeouts so I increased them to 5s but that didn’t change anything. Also, using “localhost” or “127.0.0.1” doesn’t make a difference.

Code example:

using EventStore.ClientAPI;
using System;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static async Task Main(string[] args)
        {
            var conn = EventStoreConnection.Create(new Uri("tcp://admin:changeit@localhost:1113"));
            await conn.ConnectAsync();

            var data = Encoding.UTF8.GetBytes("{\"a\":\"2\"}");
            var metadata = Encoding.UTF8.GetBytes("{}");
            var evt = new EventData(Guid.NewGuid(), "testEvent", true, data, metadata);

            await conn.AppendToStreamAsync("test-stream", ExpectedVersion.Any, evt);

            var streamEvents = await conn.ReadStreamEventsForwardAsync("test-stream", 0, 1, false);
            var returnedEvent = streamEvents.Events[0].Event;

            Console.WriteLine(
                "Read event with data: {0}, metadata: {1}",
                Encoding.UTF8.GetString(returnedEvent.Data),
                Encoding.UTF8.GetString(returnedEvent.Metadata)
            );
            Console.ReadKey();
        }
    }
}

Some of line from the server logs:

eventstore.db_1  | [    1,12,07:58:21.127,INF] External TCP connection accepted: [Normal, "172.25.0.1:51584", L"172.25.0.2:1113", {a9d08dfa-9546-429d-a306-26479e15074f}].
eventstore.db_1  | [    1, 9,07:58:23.670,INF] ES "TcpConnection" closed [07:58:23.670: N"172.25.0.1:51584", L"172.25.0.2:1113", {a9d08dfa-9546-429d-a306-26479e15074f}]:Received bytes: 153, Sent bytes: 0
eventstore.db_1  | [    1, 9,07:58:23.670,INF] ES "TcpConnection" closed [07:58:23.670: N"172.25.0.1:51584", L"172.25.0.2:1113", {a9d08dfa-9546-429d-a306-26479e15074f}]:Send calls: 0, callbacks: 0
eventstore.db_1  | [    1, 9,07:58:23.671,INF] ES "TcpConnection" closed [07:58:23.670: N"172.25.0.1:51584", L"172.25.0.2:1113", {a9d08dfa-9546-429d-a306-26479e15074f}]:Receive calls: 2, callbacks: 2
eventstore.db_1  | [    1, 9,07:58:23.671,INF] ES "TcpConnection" closed [07:58:23.671: N"172.25.0.1:51584", L"172.25.0.2:1113", {a9d08dfa-9546-429d-a306-26479e15074f}]:Close reason: [Success] "Socket closed"  
eventstore.db_1  | [    1, 9,07:58:23.672,INF] Connection '"external-normal"""' ["172.25.0.1:51584", {a9d08dfa-9546-429d-a306-26479e15074f}] closed: Success.
eventstore.db_1  | [    1,36,07:58:23.673,DBG] Persistent subscription lost connection from "172.25.0.1:51584"
eventstore.db_1  | [    1, 9,07:58:23.896,INF] External TCP connection accepted: [Normal, "172.25.0.1:51592", L"172.25.0.2:1113", {af42db3e-d331-4026-8d24-a262b4a301f4}].
eventstore.db_1  | [    1,13,07:58:38.916,DBG] Closing connection '"external-normal"""' ["172.25.0.1:51592", L"172.25.0.2:1113", {af42db3e-d331-4026-8d24-a262b4a301f4}] cleanly." Reason: HEARTBEAT TIMEOUT at receiveProgressIndicator=153, sendProgressIndicator=44"
eventstore.db_1  | [    1,13,07:58:38.916,INF] ES "TcpConnection" closed [07:58:38.916: N"172.25.0.1:51592", L"172.25.0.2:1113", {af42db3e-d331-4026-8d24-a262b4a301f4}]:Received bytes: 153, Sent bytes: 44      
eventstore.db_1  | [    1,13,07:58:38.916,INF] ES "TcpConnection" closed [07:58:38.916: N"172.25.0.1:51592", L"172.25.0.2:1113", {af42db3e-d331-4026-8d24-a262b4a301f4}]:Send calls: 2, callbacks: 2
eventstore.db_1  | [    1,13,07:58:38.916,INF] ES "TcpConnection" closed [07:58:38.916: N"172.25.0.1:51592", L"172.25.0.2:1113", {af42db3e-d331-4026-8d24-a262b4a301f4}]:Receive calls: 2, callbacks: 1
eventstore.db_1  | [    1,13,07:58:38.916,INF] ES "TcpConnection" closed [07:58:38.916: N"172.25.0.1:51592", L"172.25.0.2:1113", {af42db3e-d331-4026-8d24-a262b4a301f4}]:Close reason: [Success] "HEARTBEAT TIMEOUT at receiveProgressIndicator=153, sendProgressIndicator=44"
eventstore.db_1  | [    1,13,07:58:38.916,INF] Connection '"external-normal"""' ["172.25.0.1:51592", {af42db3e-d331-4026-8d24-a262b4a301f4}] closed: Success.
eventstore.db_1  | [    1,25,07:58:38.916,DBG] Persistent subscription lost connection from "172.25.0.1:51592"

The last section in the server logs about heartbeat get repeated 10 times before the exception is thrown in the application.

What am I missing?

All help is much appreciated:)