railmapgen / railmapgen.github.io

Landing page of RMG family
https://railmapgen.github.io
GNU General Public License v3.0
46 stars 6 forks source link

Node crashing in container due to Socket issue #106

Closed kcybul closed 2 months ago

kcybul commented 2 months ago

Hi,

I'm trying to containerize this solution and run it on Kubernetes. Unfortunately app is crashing due to Socket issue:

node:events:495
      throw er; // Unhandled 'error' event
      ^

Error: read ECONNRESET
    at TCP.onStreamRead (node:internal/stream_base_commons:217:20)
Emitted 'error' event on Socket instance at:
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -104,
  code: 'ECONNRESET',
  syscall: 'read'
}

Any idea which app part can lead to this exception ??

kcybul commented 2 months ago

The answer is:

to enable websockets on vite proxy add ws: true

like:

export default defineConfig({
  server: {
    proxy: {
      // Proxying websockets or socket.io: ws://localhost:5173/socket.io -> ws://localhost:5174/socket.io
      '/socket.io': {
        target: 'ws://localhost:5174',
        ws: true,
      },
    },
  },
})