wlvz
Explore posts from serversDTDrizzle Team
•Created by wlvz on 10/22/2023 in #help
db:push constraint is not found in the table
Hi, I'm using planetscale and trying to push to my db but I get the error:
errno: 3821,
sql: 'ALTER TABLE
Subtopic
DROP CONSTRAINT Subtopic_name_key
;',
sqlState: 'HY000',
sqlMessage: target: database.-.primary: vttablet: rpc error: code = Unknown desc = Check constraint 'Subtopic_name_key' is not found in the table. (errno 3821) (sqlstate HY000) (CallerID: yc7blbqh18eaxxd6jg4n): Sql: "alter table Subtopic drop check Subtopic_name_key", BindVars: {REDACTED}
Anyone know how I can fix this?1 replies
TTCTheo's Typesafe Cult
•Created by wlvz on 10/22/2023 in #questions
Vercel build: Module not found: Can't resolve '../build/Release/canvas.node'
I've been trying to deploy to vercel but everytime I get the error: build: Module not found: Can't resolve '../build/Release/canvas.node'
I've tried redeploying, making changes then pushing to github but nothing works. Before just redeploying would fix it but now it doesn't. Anyone know how I can fix this?
It works when building locally but not on Vercel
2 replies
TTCTheo's Typesafe Cult
•Created by wlvz on 6/29/2023 in #questions
TypeError: Cannot read properties of undefined (reading 'subscribe')
Hi, I have the following code and I keep getting the error "Cannot read properties of undefined (reading 'subscribe'), and I can't figure out how to fix it. This is the code:
When I hard refresh the page, it loads for a second and renders but then immediately after the error comes.
5 replies
DTDrizzle Team
•Created by wlvz on 6/28/2023 in #help
Cannot read properties of undefined (reading 'connectionString')
In my drizzle.config.ts I have the code:
and when I go to run drizzle-kit introspect:mysql I get the error:
I checked my .env.local and DATABASE_URL is defined:
3 replies
TTCTheo's Typesafe Cult
•Created by wlvz on 6/27/2023 in #questions
Invalid input Only "mysql2" is available options for "--driver"
I'm trying to run drizzle-kit introspect:mysql by following the docs and I have the config file:
and in my package.json I have:
in my scripts.
But when I go to run "npm run introspect" I get the error:
3 replies
DTDrizzle Team
•Created by wlvz on 6/27/2023 in #help
Invalid input Only "mysql2" is available options for "--driver"
I'm trying to run drizzle-kit introspect:mysql by following the docs and I have the config file:
and in my package.json I have:
in my scripts.
But when I go to run "npm run introspect" I get the error:
4 replies
DTDrizzle Team
•Created by wlvz on 6/25/2023 in #help
net::ERR_NAME_NOT_RESOLVED
Hi, I was following the drizzle planetscale starter made by josh (https://github.com/joschan21/drizzle-planetscale-starter) and I came across some erros I didn't know how to fix.
I have the following server component:
and when I try view this I get thousands of console errors (more errors just keep coming, its like an infinite amount of console errors) of just the same thing:
I'm pretty sure this has to do with my database URL, but I could be wrong
My db/index looks like this:
and my drizzle.config.ts looks like this:
my .env looks like this:
with ?ssl={"rejectUnauthorized":true} coming from the docs.
any idea on how to fix this? thanks
3 replies
TTCTheo's Typesafe Cult
•Created by wlvz on 6/24/2023 in #questions
net::ERR_NAME_NOT_RESOLVED Drizzle ORM
Hi, I have the following server component:
and when I try view this I get thousands of console errors of just the same thing:
I'm pretty sure this has to do with my database URL
My db/index looks like this:
and my drizzle.config.ts looks like this:
my .env looks like this:
with ?ssl={"rejectUnauthorized":true} coming from the docs.
any idea on how to fix this?
2 replies
TTCTheo's Typesafe Cult
•Created by wlvz on 6/22/2023 in #questions
Prisma Data Proxy vs Drizzle
Has anyone tried Prisma's data proxy? I'm currently just using Prisma regularly and it takes ~ 3 - 5 seconds to fetch a simple array from my DB and it's extremely inconsistent with response times varying, I use nextJS to write my API call
Client Side:
This call takes around 3-5 seconds from making the request to rendering it on the client side (I use react query on the client side). I was wondering if I use Prisma's data proxy would this be noticably faster? I'm aiming for around < 1s to 1s but as long as it's faster idm. Prisma's data proxy allows you to use the edge with Prisma which I'd rather do instead of switching to Drizzle however if Prisma's data proxy is still significantly slower than Drizzle I'd rather make the switch.
The biggest issue rn is cold starts which is why I want to use the edge, in their docs Prisma advertises "Faster cold starts" but I'm not sure how much faster it'll be. I console logged the time the response would take and the first (cold start) req takes: 2640.547416985035 milliseconds (2.6s) and after that it takes 487.4787500202656 milliseconds (0.487s). Is it worth using Prisma's data proxy or should I just switch to Drizzle?
Thanks
8 replies
TTCTheo's Typesafe Cult
•Created by wlvz on 6/21/2023 in #questions
CORS Issue on only some API calls
I have multiple API calls on my project deployed to vercel but only some of them face CORS issues, for example:
works perfectly fine however
doesn't work when visiting the production URL despite the first one working. I get this error:
Access to XMLHttpRequest at 'http://localhost:3000/api/fetchtopicid?name=electricity' from origin '' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
15 replies
TTCTheo's Typesafe Cult
•Created by wlvz on 6/17/2023 in #questions
Error: PrismaClient is unable to be run in the browser.
12 replies
TTCTheo's Typesafe Cult
•Created by wlvz on 6/10/2023 in #questions
ESLint changes don't show when running turbo build
Hi, in my .eslintrc.cjs file I've made some changes which include warning instead of throwing errors for certain rules, for example this is my file:
I've changed "no-misused-promises" to warn instead of showing an error but when I run turbo build I get the error:
Shouldn't this just show a warning instead of throwing an error or am I doing something wrong? I'm using Next 13.4 with the app router and this occurs when running both npm run build and turbo build.
When I change them from warn to off the error still occurs.
8 replies
TTCTheo's Typesafe Cult
•Created by wlvz on 6/7/2023 in #questions
prisma nested writes / updates not working
My prisma schema currently looks like this:
I want to make an API call which creates a topic specific to a subject. For example, if I specify that the subject is biology, it should make a new topic nested under biology. This is my current code which attempts that:
However when I try calling this API I get a 405 error, in addition to that I'm pretty sure the way I'm trying to do this is wrong as well. How would I be able to do this? Thanks
8 replies
TTCTheo's Typesafe Cult
•Created by wlvz on 6/5/2023 in #questions
Dynamic Routes with AWS Object Keys
Hi, I'm currently building a website where I need to fetch PDF's from S3. I've managed to get that working however the object key is currently hardcoded. I want to change this so that my object key gets taken from the URL. For example, if the user visits /exams/biology/photosynthesis1 it sets the object key to biology/photosynthesis1. If they visit /exams/physics/forces, it sets the object key to physics/forces. How would I do that?
I've attached my code below:
23 replies
TTCTheo's Typesafe Cult
•Created by wlvz on 6/3/2023 in #questions
405 Error with S3 Presigned URL's
I currently have a 'PDF viewer' on my website which is suppose to render a PDF from my s3 bucket and prevent the user from being able to download, print, etc the pdf.
Here's the code for the /exams/page.tsx file (the PDF viewer)
(continued because im running out of characters)
12 replies
TTCTheo's Typesafe Cult
•Created by wlvz on 5/26/2023 in #questions
get S3 Object (pdf) and display it on a unique url based on object name
Hi, I currently have multiple pdfs held on S3 and I'm building an app where I need to display these PDFs based on the name of the object. For example, I have a pdf named photosynthesis 1.pdf, it's held in the biology/ folder and I need to display this pdf on domain.com/exams/{biology}/{photosynthesis 1.pdf}
How can I make it so that when a user visits this url, it displays the pdf related to that url on the site. Or should I approach this differently? I've tried searching but couldn't find anything that worked, I'm pretty new to S3 so I'm a little lost.
Another option I'm considering is waiting on upload thing to support pdfs and using that instead but I'm not sure when that will be ready and I need to finish the site ASAP.
Thanks
4 replies