Mr Volcano
Explore posts from serversDTDrizzle Team
•Created by Mr Volcano on 11/3/2023 in #help
Appending SQL chunks to a query
Hey everyone, I'm trying to see if there is a way where I can build SQL queries conditionally (based on some search params I get)
13 replies
DTDrizzle Team
•Created by Mr Volcano on 11/1/2023 in #help
Unable to run migrations
I have this small script I'm running to perform the db migrations:
I've made sure the migrationsFolder is the one I want, it has a sql migration file that looks like this (it has more fields ofc):
I get no erros but my db remains the same, you got any ideas ?
11 replies
DTDrizzle Team
•Created by Mr Volcano on 10/24/2023 in #help
Postgres timestamp that will be the same across regions
Hello everyone,
So I have a statement like the following:
Becaue I want my backend code to store the same timestamp no matter the region.
But drizzle schema file is red on:
Because:
Will this cause me issues in the future ? All I'm trying to do is to have my backend set "created_at" the same across different regions. I'm pretty new so any suggestions would be great, thanks!
1 replies
TTCTheo's Typesafe Cult
•Created by Mr Volcano on 10/19/2023 in #questions
VercelPostgresError - 'missing_connection_string'
Hello everyone!
So I'm getting the following error while trying to use the
@vercel/postgres
package with drizzle ORM
Here is my db index.ts
As well as my drizzle.config.ts
Few notes:
1. The URL is provided in connectionString. I'm sure it's defined. I have even hardcoded it. I'm 99% sure that the case is that Vercel postgres doesn't really read it and is trying to look for POSTGRES_URL
in the env (which is not present because I want to use prefixes for each DB depending on the environment).
2. As you can probably already guess I'm trying to make it so depending on the environment I'm using a different DB. You got any advice on that?2 replies
DTDrizzle Team
•Created by Mr Volcano on 10/19/2023 in #help
VercelPostgresError - 'missing_connection_string': You did not supply a 'connectionString'
Hello everyone!
So I'm getting the following error while trying to use the
@vercel/postgres
package with drizzle ORM
Here is my db index.ts
As well as my drizzle.config.ts
Few notes:
1. The URL is provided in connectionString. I'm sure it's defined. I have even hardcoded it. I'm 99% sure that the case is that Vercel postgres doesn't really read it and is trying to look for POSTGRES_URL
in the env (which is not present because I want to use prefixes for each DB depending on the environment).
2. As you can probably already guess I'm trying to make it so depending on the environment I'm using a different DB. You got any advice on that?14 replies
DTDrizzle Team
•Created by Mr Volcano on 10/18/2023 in #help
VercelPostgresError - 'missing_connection_string'
Hello everyone, so I've been beating my head with this for a couple of hours
I had managed to make it work initially but after changing some things up and setting up different DBs for staging, dev and prod it is no longer working
When I run
npm run dev
the right env variables are loaded like ( DEV_POSTGRES_URL: 'postgres://defaul...
but drizzle still gives me the error in the title.
My config looks like this:
But I get the same error even when I just hardcore the string.
Any ideas ?2 replies
DTDrizzle Team
•Created by Mr Volcano on 8/30/2023 in #help
node-postgres uses crypto under the hood ?
Hello everyone, so I'm migrating from Prisma to Drizzle so I can use the NextJS's edge runtime
I'm trying to make a query inside my edge middleware and I get the following error:
The edge runtime does not support Node.js 'crypto' module.
I'm using node-postgress
as I've already mentioned
What are my options here ?16 replies
TTCTheo's Typesafe Cult
•Created by Mr Volcano on 8/14/2023 in #questions
AWS Amplify Auth on a NextJS app
Hello everyone. I have a NextJS 13 app and I want to use the Amplify auth SDK for auth since it's convenient.
The "problem" is that I've found it to be mostly a client-side SDK whereas I want to use it strictly on my API routes.
Should I use it or should I go for raw Cognito ?
2 replies
TTCTheo's Typesafe Cult
•Created by Mr Volcano on 8/11/2023 in #questions
How to handle authentication in nextJS app with AWS Amplify
Hello everyone. I'm creating a new app and I'm trying to figure ou what would be the best way to handle user authentication.
The user signs up with an email and a password, they then get a verification email in their inbox (that's all handled by AWS Amplify).
I have a few questions like:
1. Where do I store the user ? Should I use an AuthProvider ?
2. What about letting the server know that the frontend is authorised ? Should I use a middleware ?
2 replies
TTCTheo's Typesafe Cult
•Created by Mr Volcano on 7/19/2023 in #questions
Framework recomendations for jobs running with NodeJS
Hey everyone!
I want to write a Node backend. It's not going to be a REST API but more like a couple of services that run as jobs on certain intervals and update database tables.
I initially thought about using Express since it's the goto for Node but I'm now considering fastify.
Do you think it would be a good option for my case ?
I've never written code similar to this (I normally do FullStack with NextJS) so I'm not sure even if I need a framework on top of node given that I'm not making a REST API but rather running some jobs on intervals.
To make things more clear, here's the functionality I'm looking to implement:
A couple of jobs running on set intervals. Perhaps they interact with eachother so they run one after the other.
Authentication
Logging
Could be more but that's what I got for now. Definitely no REST APIs used by clients
11 replies
TTCTheo's Typesafe Cult
•Created by Mr Volcano on 7/9/2023 in #questions
Some good old system design
Hello everyone, how you doing ?
So I want to create a little app that consists of 2 main parts system-design-wise - and I'd like to know where you think I should host it (could be multiple platforms).
Code Stack: NextJS,
FIRST PART: Your good old CRUD app where users can create, read, update stuff. Nothing crazy here. SECOND PART: A job that's reading rows from a SQL table. Then for each row it performs some requests on an API, then based on that result it updates 2 other tables and it also might need to save media (pictures, 20s videos) on some blob storage (think S3 or something). This job will be running regularly since its function is to keep stuff up to date. Now, how many entires could the job table have ? Think 10-100. And then for each of these entries we might need to perform another 100-200 requests to check if data needs updating. Then 80% of the time the data will need updating and 50% of the time we will also need to put some sort of media into a blob storage. I want the system to be up to date every 5m. Ofc if the app is succesfull things will need to change in the future but that's it for now. MY TAKE: For the first part. Vercel. $20 / month and we're well below reaching any limits For the second part: 1. AWS EC2 for the job since Lamba wont work due to it running continuously and sometimes having to deal with media (20s videos). 2. RDS for a SQL (or DynamoDB) that's going to be getting getting updated regularly. 3. S3 for Blob storage Where I'm a bit hesitant is on the part where I use AWS. Perhaps this can all be done through Vercel (with the exception of Blob ofc). But then if I do need to use AWS, why not put the entire thing on AWS and save that flat fee of 20/month + having to coordinate between 2 different vendors.
FIRST PART: Your good old CRUD app where users can create, read, update stuff. Nothing crazy here. SECOND PART: A job that's reading rows from a SQL table. Then for each row it performs some requests on an API, then based on that result it updates 2 other tables and it also might need to save media (pictures, 20s videos) on some blob storage (think S3 or something). This job will be running regularly since its function is to keep stuff up to date. Now, how many entires could the job table have ? Think 10-100. And then for each of these entries we might need to perform another 100-200 requests to check if data needs updating. Then 80% of the time the data will need updating and 50% of the time we will also need to put some sort of media into a blob storage. I want the system to be up to date every 5m. Ofc if the app is succesfull things will need to change in the future but that's it for now. MY TAKE: For the first part. Vercel. $20 / month and we're well below reaching any limits For the second part: 1. AWS EC2 for the job since Lamba wont work due to it running continuously and sometimes having to deal with media (20s videos). 2. RDS for a SQL (or DynamoDB) that's going to be getting getting updated regularly. 3. S3 for Blob storage Where I'm a bit hesitant is on the part where I use AWS. Perhaps this can all be done through Vercel (with the exception of Blob ofc). But then if I do need to use AWS, why not put the entire thing on AWS and save that flat fee of 20/month + having to coordinate between 2 different vendors.
1 replies
TTCTheo's Typesafe Cult
•Created by Mr Volcano on 12/12/2022 in #questions
NextJS Fetching an image that statically served from a microservice
Hey all. There's a Java backend that's hosting some images. I would like to have a nextJS api route that's going to fetch an image from there and then return it so the NextJS client can use it.
Right now I'm doing:
So far so good but
imageRes
is still a promise (as the name implies). I want to return the actual image but .json()
doesn't work because it's an image and can't be converted into a JS object
Any ideas how I can go about this one ?2 replies