itslekan
itslekan
Explore posts from servers
CCConvex Community
Created by itslekan on 12/17/2024 in #support-community
Database Structure Help
Hey I need a little help trying to structure my database. I'm making a tenant management app. There are multiple managers and each manager can create multiple properties and add one tenant per property. There is a page that allows the manager to view all his tenants but for that to work I need to get all their properties and then get all the tenants under each property It feels really tedieous and I was wondering if there is a smarter more proper way to do this I feel like the tenant should also have a manager_id field but I don't know if that's how it should be done The tree normally looks like manager -> property -> tenant but now it's make it manager-> property -> tenant but also manager -> tenant
13 replies
TTCTheo's Typesafe Cult
Created by itslekan on 12/10/2024 in #questions
bunx shadcn@latest init
I prompted v0.dev to create a starter template and I copied the command and changed the npx to bunx --bun and ran it only to find this error
error: Cannot find module '@jridgewell/gen-mapping' from '/private/tmp/bunx-501-shadcn@latest/node_modules/@babel/generator/lib/source-map.js'
error: Cannot find module '@jridgewell/gen-mapping' from '/private/tmp/bunx-501-shadcn@latest/node_modules/@babel/generator/lib/source-map.js'
I only just installed bun so maybe I didn't configure something write. bunx works for other things like bunx --bun prettier foo.js so I'm sure the problem is a shadcn@latest one. Any help would be appreciated thank you.
6 replies
CCConvex Community
Created by itslekan on 12/10/2024 in #support-community
Error: `headers` was called outside a request scope.
I recently switched devices and I wanted to continue working on my project. So I pulled all the code from github and ran convex dev. Everything seemed to be working find and even the env's got filled in as well. This project is currently running in production on vercel so I know it works. But when I try to run it I keep getting this error
Error: `headers` was called outside a request scope. Read more: https://nextjs.org/docs/messages/next-dynamic-api-wrong-context
Error: `headers` was called outside a request scope. Read more: https://nextjs.org/docs/messages/next-dynamic-api-wrong-context
After some debugging. I've norrowed down the problem to be in the convexAuthNextjsMiddleware. I cleared my previous middleware and copy pasted the default middleware and still the same error. I can't figure out what I'm doing wrong. I'll appreciate any help I could get. Thank you.
3 replies
CCConvex Community
Created by itslekan on 11/30/2024 in #support-community
nextjs handling server-side errors in error page
I'm using Nextjs, and I've setup a catch all error page to handle all errors, I've set it up to show formatted convex Errors if it's instanceof ConvexError see code below:
"use client";

import ...

export default function Error({
error,
}: {
error:
| ConvexError<{ title: string; body: string }>
| (Error & { digest?: string });
}) {
...
if (error instanceof ConvexError)
return (
<AnimatedGroup
preset="blur-slide"
className="flex flex-col px-10 justify-center items-center flex-1 gap-2"
>
<div className="p-4 rounded-full text-red-700 bg-red-100">
<CircleAlert className="size-6" />
</div>
<div className="text-center">
<h2 className="font-bold">{error.data.title}</h2>
<p className="text-muted-foreground">{error.data.body}</p>
</div>
</AnimatedGroup>
);
...
);
}
"use client";

import ...

export default function Error({
error,
}: {
error:
| ConvexError<{ title: string; body: string }>
| (Error & { digest?: string });
}) {
...
if (error instanceof ConvexError)
return (
<AnimatedGroup
preset="blur-slide"
className="flex flex-col px-10 justify-center items-center flex-1 gap-2"
>
<div className="p-4 rounded-full text-red-700 bg-red-100">
<CircleAlert className="size-6" />
</div>
<div className="text-center">
<h2 className="font-bold">{error.data.title}</h2>
<p className="text-muted-foreground">{error.data.body}</p>
</div>
</AnimatedGroup>
);
...
);
}
This works fine when the error comes from client side, but it completely breaks for server side requests like fetchQuery. I've looked through the docs and this is not addressed at all.
{
"stack": "ConvexError: [Request ID: f159ead0758d53c7] Server Error\nUncaught ConvexError: {\"title\":\"Access denied\",\"body\":\"You do not have access to this store\"}...",
"digest": "1811788005"
}
{
"stack": "ConvexError: [Request ID: f159ead0758d53c7] Server Error\nUncaught ConvexError: {\"title\":\"Access denied\",\"body\":\"You do not have access to this store\"}...",
"digest": "1811788005"
}
here's the error. As you can see it's not the usual that has the data key. Any help with this would be appreciated. Thanks
6 replies
CCConvex Community
Created by itslekan on 10/18/2024 in #support-community
Server ErrorUncaught Error: Uncaught TypeError: "pkcs8" must be PKCS#8 formatted string
I keep getthing this error when I try to sign in with convex auth "Password"
Server Error
Uncaught Error: Uncaught TypeError: "pkcs8" must be PKCS#8 formatted string
Server Error
Uncaught Error: Uncaught TypeError: "pkcs8" must be PKCS#8 formatted string
Any Ideas
6 replies
TTCTheo's Typesafe Cult
Created by itslekan on 11/13/2023 in #questions
Should I make a separate REST api or use my Next project as the api backend
I built a dashboard to allow admins to add products and view orders. What I want to do now is to create a separate project, an e-commerce website for, say stationaries. I want this project to simply call an api for all the backend work. I don't know if I should build the api in the Nextjs project where I did the dashboard or create a separate REST or graphql project. I'm leaning more towards separating it but I want to hear more opinions before I commit to something thanks
16 replies