encore icon indicating copy to clipboard operation
encore copied to clipboard

Run fails with `An existing connection was forcibly closed by the remote host`

Open alpap opened this issue 1 year ago • 4 comments
trafficstars

Platform: Windows 11 Docker: WSL Terminal: Powershell

After initializing I run

encore run
 ⠒ Building Encore application graph...
 ⠂ Analyzing service topology...
 ⠙ Starting Encore application...

 Encore development server running!

 Your API is running at:     http://127.0.0.1:4000
 Development Dashboard URL:  http://localhost:9400/gm6q8

10:58PM FTL connection failure error="rpc error: code = Unavailable desc = error reading from server: read unix @->C:\\Users\\alpap\\AppData\\Local\\encore\\encored.sock: wsarecv: An existing connection was forcibly closed by the remote host."

alpap avatar Oct 10 '24 21:10 alpap

Which version of Encore are you running? Is this still happening on v1.41.11 (just released)?

eandre avatar Oct 12 '24 13:10 eandre

I am facing the same issue, fresh install and trying to run hello world. The same setup (Windows 11, Docker WSL, Powershell) encore version v1.44.9

RednotePL avatar Dec 05 '24 01:12 RednotePL

Same issue with encore version v1.45.2 running on W11.

UPDATE: Temporary workaround after many trials and errors:

  • enter your default WSL (preferably a Debian one but it's up to you)
  • install encore cli
  • install node via your preferred method (cof cof, NVM, cof cof)
  • ensure the WSL proxies all docker requests to the Windows host (a simple check that the same images exist on the host and in the WSL is enough)
  • run encore run as always, it should work, notice that the dependencies (npm ones) will result in corruption if you're writing from your code from Windows.

There are definitely some compatibility problems with Windows hosts.

For dev reference, the problem resides in the daemon not being able to open some ports (even if they are available) the following is the log generated by the crash.

daemon.log

ebalo55 avatar Jan 03 '25 06:01 ebalo55

My cause to error like this one is:

interface DataPatchesResponse {
    [id: string]: any;
}

const getDataPatchId = (type: string, id: string): string => {
    return `${type}:${id}`;
}

export const getAll = api(
    { method: "GET", path: "/data-patch", expose: true },
    async (): Promise<DataPatchesResponse> => {
        const rows = await prisma.dataPatch.findMany();
        const response = {} as DataPatchesResponse;
        for (const row of rows) {
            response[getDataPatchId(row.type, row.dataId)] = row.data;
        }
        return response;
    },
);

It is because of DataPatchesResponse

insthync avatar Apr 24 '25 13:04 insthync