GamerZero
GamerZero
Explore posts from servers
TTCTheo's Typesafe Cult
Created by GamerZero on 7/22/2024 in #questions
Controller is already closed error
My production logs are filled with this error
TypeError [ERR_INVALID_STATE]: Invalid state: Controller is already closed
at ReadableStreamDefaultController.enqueue (node:internal/webstreams/readablestream:1074:13)
at /app/.next/server/app/api/trpc/[trpc]/route.js:5:31811
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
code: 'ERR_INVALID_STATE'
}
TypeError [ERR_INVALID_STATE]: Invalid state: Controller is already closed
at ReadableStreamDefaultController.enqueue (node:internal/webstreams/readablestream:1074:13)
at /app/.next/server/app/api/trpc/[trpc]/route.js:5:31811
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
code: 'ERR_INVALID_STATE'
}
Is there anything i can do about it?
7 replies
DTDrizzle Team
Created by GamerZero on 7/14/2024 in #help
Stack overflow when trying to insert many values at once
I'm using drizzle with nextjs so the code is chunked into separate bundles by nextjs it seems, but there are mentions of SQL in the stacktrace and i'm not using any ORM other than drizzle in my project. Here's my code:
await db.insert(table).values(largeListOfValues)
await db.insert(table).values(largeListOfValues)
where largeListOfValues.length is around 30000-40000 entries 5 columns each. And the error:
RangeError: Maximum call stack size exceeded
at /app/.next/server/chunks/662.js:7:27038
at g.buildQueryFromSourceParams (/app/.next/server/chunks/662.js:7:27141)
at /app/.next/server/chunks/662.js:7:26566
at Object.startActiveSpan (/app/.next/server/chunks/662.js:7:32523)
at g.toQuery (/app/.next/server/chunks/662.js:7:26516)
at C.sqlToQuery (/app/.next/server/chunks/662.js:7:7089)
at /app/.next/server/chunks/662.js:1:45521
at Object.startActiveSpan (/app/.next/server/chunks/662.js:7:32523)
at QueryPromise._prepare (/app/.next/server/chunks/662.js:1:45439)
at /app/.next/server/chunks/662.js:1:45671
RangeError: Maximum call stack size exceeded
at /app/.next/server/chunks/662.js:7:27038
at g.buildQueryFromSourceParams (/app/.next/server/chunks/662.js:7:27141)
at /app/.next/server/chunks/662.js:7:26566
at Object.startActiveSpan (/app/.next/server/chunks/662.js:7:32523)
at g.toQuery (/app/.next/server/chunks/662.js:7:26516)
at C.sqlToQuery (/app/.next/server/chunks/662.js:7:7089)
at /app/.next/server/chunks/662.js:1:45521
at Object.startActiveSpan (/app/.next/server/chunks/662.js:7:32523)
at QueryPromise._prepare (/app/.next/server/chunks/662.js:1:45439)
at /app/.next/server/chunks/662.js:1:45671
4 replies
TtRPC
Created by GamerZero on 9/12/2023 in #❓-help
Cannot set headers in procedures with fetch adapter
Am i right that with such a setup in nextjs app router route handler:
const handler = async (request: NextRequest) => {
const response = await fetchRequestHandler({... request ...})
return response
}
const handler = async (request: NextRequest) => {
const response = await fetchRequestHandler({... request ...})
return response
}
It is currently impossible to set headers inside a procedure, cause fetchRequestHandler just starts to stream proceddure response as body and resolves immedieately, not waiting for it to finish? That's the behaviour that im observing right now: 1) setting header in procedure and logging 2) logging after await fetchRequestHandler() 3) first log is shown after the second one And headers are not set cause body already started streaming i think
6 replies
TTCTheo's Typesafe Cult
Created by GamerZero on 1/30/2023 in #questions
How to preload conditionally rendered next/image
In my app i have slideshow/presentation thing where images appear in full-screen one after another. I achieve that using conditional rendering (show different images based on a state). The problem is that when the slide is shown for the first time, image starts loading and worsens the experience. How could i preload all the images at once? I've already tried adding next/head with <link rel="preload" as="image" type="image/png" /> for all the required images, but it doesn't seem to help.
1 replies
TTCTheo's Typesafe Cult
Created by GamerZero on 12/25/2022 in #questions
Prisma suddenly stopped working in docker deployments
My docker deployments of T3 apps just broke. They all use the up-to-date Dockerfile from the T3 docks. Strangely, it seems to me like even those that i haven't rebuilt in a long time broke. So the problem might be somewhere in my system maybe? (my host is Ubuntu 22.04). Here's the error i get when any prisma call happens in my app:
Unable to load Node-API Library from /app/node_modules/.prisma/client/libquery_engine-linux-musl.so.node, Library may be corrupt
Unable to load Node-API Library from /app/node_modules/.prisma/client/libquery_engine-linux-musl.so.node, Library may be corrupt
1 replies
TTCTheo's Typesafe Cult
Created by GamerZero on 11/22/2022 in #questions
Is it possible to run websocket (trpc subscriptions) server in the same process as nextjs app?
Official TRPC example on using websockets with next (https://github.com/trpc/examples-next-prisma-websockets-starter) seem to run them separately, but it doesn't really look right to me, as i'm not ever planning to run my app on edge or serverless, and just want this stupid-simple monolith.
10 replies