_tweak^prone
Explore posts from serversDTDrizzle Team
•Created by _tweak^prone on 7/31/2023 in #help
Drizzle + Astro => ETIMEDOUT
I have been running Astro with Drizzle for a period of time now, in one project. The project used to use Prisma, but i wanted to try out Drizzle
When i develop on the project, i run the astro with
npm run dev
. I connect to Drizzle with this piece of code:
It works perfectly, HOWEVER, after a while of inactivity - when i do not reload the page often enough - then I will (once i reload) get a ETIMEDOUT and npm run dev
simply just breaks the current process, and quitting npm altogether.
If i convert back to Prisma - I do not get this behavour.
If i try to use "non-pool" version of Drizzle, then it appears that drizzle does not close connections to my MySQL, and i hit the "max 10 connections" limit of my database.
Any advise would be greatly appreciated.1 replies
TTCTheo's Typesafe Cult
•Created by _tweak^prone on 7/30/2023 in #questions
Astro + DrizzleORM => trouble
Im working with Drizzle ORM on Astro and im having some problems with continous "ETIMEDOUT". When using Prisma for the same project, I have no problem connecting to the MySQL.
Anyone has a clue as to what this could be ?
Does DrizzleORM and Astro play nice together ? Aka: will Drizzle close its connections once done ?
It could seem like its a connection-not-closing problem, as my MySQL has maximum of 10 connections, and once this error happens, it will instantly "ETIMEDOUT" for every request, until i stop/start Astro server.
75 replies
TTCTheo's Typesafe Cult
•Created by _tweak^prone on 5/31/2023 in #questions
TypeSafe external API ?
I am currently communicating with an external API and after falling in love with TRPC, I would like to make this communication with the external API as TypeSafe as possible as well.
I am however kinda failing in the basics of figuring out how to return different types, depending on the inputs of my function call.
Example, i can call the same endpoint on my external API with the parameter "withItems", which kinda ends up mimicking the Prisma version of "include" - but unlike the great work Prisma has done - I am unsure how to detect if the programmer (in this case - mostly me), has passed this parameter to my API call function and return a different typesafe-type. I therefore always end up returning a mixed result (one type - or the other).
My models are these (simplified):
My first attempts where to make a function call where I did something similar to this:
However my initial approach resulted in my having to typecast the result from getOrder - since I never succeded in making a "strong" connection between the parameters of the call, and the result.
In comes Zod - which i believe would be my saviour here - but I fail to get Zod working. I simply cannot grasp my head around how I would implement Zod in this kind of structure and get type-safe return.
Hope you can help (and I have formulated my question clear enough)
28 replies
TTCTheo's Typesafe Cult
•Created by _tweak^prone on 4/12/2023 in #questions
useSession returns unauthorized
I am using the standard t3 stack setup with NextAuth - session provider wrapped around it all. My middleware is set to protect all pages (default export).
When i log in with credentials, and try to use useSession from my Component, i get status:unauthorized.
In addition: The first initial page of my app loads, since i just authorized but when navigating to any other page, i have to auth again.
What did I forget to implement ?
1 replies
TTCTheo's Typesafe Cult
•Created by _tweak^prone on 2/2/2023 in #questions
MUI + Vercel => different CSS applied
When I use
npm run dev
to develop my website - my css is applied "as intended" - and I have styled my MUI-components to match my needs. However, when I push it to Vercel, it seems that the custom MUI-classes, gets added last (even though the order in class='' is the same).
When rendered on Vercel, MUI-classes are the last classes in the cascade (viewed in Inspector), where as when rendered locally, MUI-classes are soms of the first in the cascade - this getting overwritten.
This results in drastic different results on dev and prod.
How can i make sure the behaviour is the same ?11 replies