5648
5648ā€¢10mo ago

Dockerizing in TRPC

Hi guys, I am developing a Next app with TRPC subscriptions/websockets and am running into issues trying to dockerize it. I took a look at the example project at https://github.com/trpc/examples-next-prisma-websockets-starter and saw that the docker-compose only dockerized the database and not the nextjs app. I was wondering if there was a reason for this. My app works fine locally but as soon as I try to run it in a docker container, I get various errors like the websocket connection closing a few seconds into using the app. Here's some excerpts of the errors
app-name | free(): double free detected in tcache 2
postgres | 2023-08-04 17:09:15.979 UTC [36] LOG: could not receive data from client: Connection reset by peer
app-name | Aborted

app-name | malloc(): unaligned fastbin chunk detected
postgres | 2023-08-04 17:11:24.945 UTC [36] LOG: could not receive data from client: Connection reset by peer
postgres | 2023-08-04 17:11:24.945 UTC [38] LOG: could not receive data from client: Connection reset by peer
postgres | 2023-08-04 17:11:24.945 UTC [37] LOG: could not receive data from client: Connection reset by peer
app-name | Aborted
app-name | [nodemon] app crashed - waiting for file changes before starting...
app-name | free(): double free detected in tcache 2
postgres | 2023-08-04 17:09:15.979 UTC [36] LOG: could not receive data from client: Connection reset by peer
app-name | Aborted

app-name | malloc(): unaligned fastbin chunk detected
postgres | 2023-08-04 17:11:24.945 UTC [36] LOG: could not receive data from client: Connection reset by peer
postgres | 2023-08-04 17:11:24.945 UTC [38] LOG: could not receive data from client: Connection reset by peer
postgres | 2023-08-04 17:11:24.945 UTC [37] LOG: could not receive data from client: Connection reset by peer
app-name | Aborted
app-name | [nodemon] app crashed - waiting for file changes before starting...
Here is the docker-compose section for the app
version: '3.8'
services:
app:
build:
context: .
dockerfile: Dockerfile
ports:
- 3000:3000
environment:
- DATABASE_URL=${DATABASE_URL}
depends_on:
- db
restart: always
volumes:
- ./:/usr/src/app
- /usr/src/app/node_modules
- /usr/src/app/.next
- /dev/null:/usr/src/.npmrc
version: '3.8'
services:
app:
build:
context: .
dockerfile: Dockerfile
ports:
- 3000:3000
environment:
- DATABASE_URL=${DATABASE_URL}
depends_on:
- db
restart: always
volumes:
- ./:/usr/src/app
- /usr/src/app/node_modules
- /usr/src/app/.next
- /dev/null:/usr/src/.npmrc
If anything else can help, please let me know and I will provide it in the thread. Thank you šŸ™‚
GitHub
GitHub - trpc/examples-next-prisma-websockets-starter: šŸ“ tRPC Next....
šŸ“ tRPC Next.js WebSocket Starter. Contribute to trpc/examples-next-prisma-websockets-starter development by creating an account on GitHub.
0 Replies
No replies yetBe the first to reply to this messageJoin