PinkiePie
PinkiePie
Explore posts from servers
TtRPC
Created by PinkiePie on 12/27/2024 in #❓-help
trpc doesn't work after migrating to next 15
When i upgraded to Next 15 (pages router), all trpc routes fails with status 500 on production. The result message is {"error":{"json":{"message":"req.socket.once is not a function","code":-32603,"data":{"code":"INTERNAL_SERVER_ERROR","httpStatus":500}}}}. I don't really understand if it's TRPC issue, Next issue or even Netlify issue (i host my website there, but they declare to support Next 15). Does anybody have an idea where the problem could be? I don't call req.socket.once anywhere in my code, so the issue is probably with one of those places
15 replies
TtRPC
Created by PinkiePie on 6/14/2024 in #❓-help
Websocket connects even without any subscriptions
Currently, when I add a WS link, it tries to connect to the server right away. How can I prevent this behavior and allow it to connect only if there are any active subscriptions? Unlogged users don't have subscriptions, so they should not connect to WS server
6 replies
PPrisma
Created by PinkiePie on 6/12/2024 in #help-and-questions
how to make fields selection mandatory?
Currently, both select and include are optional fields, more of that it's possible to pass just true, without specifying every field:
prisma.post.create({
data: ...
include: {
user: true,
},
})
prisma.post.create({
data: ...
include: {
user: true,
},
})
how can i force prisma to make select or include mandatory and allow to pass only fields specifications instead of just true?
prisma.post.create({
data: ...
select: {
user: {
select: {
id: true,
name: true,
}
}
}
})
prisma.post.create({
data: ...
select: {
user: {
select: {
id: true,
name: true,
}
}
}
})
2 replies
PPrisma
Created by PinkiePie on 5/19/2024 in #help-and-questions
how to return an empty array instead of null
I have such a type:
type P {
id String
m Int[]
}
type P {
id String
m Int[]
}
In the database, some items doesn't have field m at all. When I query such items, m is set to null. How to return an empty array instead? It feel weird that Prisma disallows optional lists, so typescript type will be like that: {id: string, m: number: []} but I still have to check that the field m exists before accessing it
5 replies