Voxelum / minecraft-launcher-core-node

Provide packages to install Minecraft, launch Minecraft and more to build launcher with NodeJs/Electron!
https://docs.xmcl.app/en/core/
MIT License
178 stars 26 forks source link

Error: Client network socket disconnected before secure TLS connection was established #278

Open Gagafeee opened 11 months ago

Gagafeee commented 11 months ago

Hi another bug form me, when i use installTask to download minecraft files

const versionList = await getVersionList();
const xmclVersion = versionList.versions.find((MinecraftVersion) => {
  return MinecraftVersion.id === version.id;
});
////
const mainTask = installTask(xmclVersion, dir);
await mainTask.startAndWait({
  onUpdate(task: any, chunkSize: number) {
    //...
  },
  onFailed(task: any, error: any) {
    console.error(task, ' failed with error ', error);
    //...
  },
  onSucceed(task: any, result: any) {
    console.log(task, ' finished');
    //...
  }
});

The JAR and the JSON are correctly installed, but (around 40%) during the libs and assets download, the following error appears each time

{
    "DownloadAggregateError": "Multiple errors occurred during download process\n at download (BushLauncher-v4\node_modules\@xmcl\file-transfer\download.ts:200:11)\n at async InstallAssetTask.runTask (BushLauncher-v4\node_modules\@xmcl\task\index.ts:260:24)": {
        "urls": [
            "https://resources.download.minecraft.net/5f/5ff04807c356f1beed0b86ccf659b44b9983e3fa"
        ],
        "headers": {},
        "destination": "K:\BushLauncher\instances\vanilla\assets\objects\5f\5ff04807c356f1beed0b86ccf659b44b9983e3fa",
        "name": "DownloadAggregateError",
        "stack": "DownloadAggregateError: Multiple errors occurred during download process\n at download (BushLauncher-v4\node_modules\@xmcl\file-transfer\download.ts:200:11)\n at async InstallAssetTask.runTask (BushLauncher-v4\node_modules\@xmcl\task\index.ts:260:24)",
        "message": "Multiple errors occurred during download process",
        "errors": [
            {
                "Error": "Error: Client network socket disconnected before secure TLS connection was established at connResetException (node:internal/errors:711:14) at TLSSocket.onConnectEnd (node:_tls_wrap:1593:19) at TLSSocket.emit (node:events:525:35) at TLSSocket.emit (node:domain:489:12) at endReadableNT (node:internal/streams/readable:1359:12) at processTicksAndRejections (node:internal/process/task_queues:82:21)",
                "code": "ECONNRESET",
                "path": undefined,
                "host": "resources.download.minecraft.net",
                "port": 443,
                "localAddress": null,
                "url": "https://resources.download.minecraft.net/5f/5ff04807c356f1beed0b86ccf659b44b9983e3fa",
                "stack": "Error: Client network socket disconnected before secure TLS connection was established\n at connResetException (node:internal/errors:711:14)\n at TLSSocket.onConnectEnd (node:_tls_wrap:1593:19)\n at TLSSocket.emit (node:events:525:35)\n at TLSSocket.emit (node:domain:489:12)\n at endReadableNT (node:internal/streams/readable:1359:12)\n at processTicksAndRejections (node:internal/process/task_queues:82:21)",
                "message": "Client network socket disconnected before secure TLS connection was established"
            }
        ]
    }

This error always appears with the same library (in 1.20.1), (but with different url each time)

Thanks in advance for help !