Json 👺
Json 👺
Explore posts from servers
BABetter Auth
Created by Json 👺 on 4/9/2025 in #help
Custom values into `authClient.signIn.social()`?
Terrific, thanks!
5 replies
DTDrizzle Team
Created by Jakesdoc on 4/17/2024 in #help
Generate relational select types
https://github.com/drizzle-team/drizzle-orm/issues/695 Still an open issue but some have shared some solutions. Hopefully in the next year we'll get a native option. Really hoping for it.
2 replies
DTDrizzle Team
Created by cody on 7/27/2023 in #help
Is there a way I can use relational types?
one day we'll have native type inference for relational queries like Prisma has
19 replies
TtRPC
Created by Arxk on 3/27/2025 in #❓-help
Sending FormData does not work at all
Hey, would you mind posting your specific solution using splitLink? I am having a hard time implementing this. I wish the docs explained some of this now that this feature is released.
23 replies
BABetter Auth
Created by Json 👺 on 2/8/2025 in #help
Correct way to determine the baseURL?
👏
6 replies
BABetter Auth
Created by Json 👺 on 2/8/2025 in #help
Correct way to determine the baseURL?
Perfect! Have you considered allowing explicit baseURL definition (on the server) to cut down on environment variables? An extra variable is no big deal, but I'm curious.
6 replies
BABetter Auth
Created by Json 👺 on 2/8/2025 in #help
Correct way to determine the baseURL?
It would be nice if we could explicitly determine the baseURL on the server as well, this way we could just use a single function like the one used in tRPC 🙂 Thanks
6 replies
BABetter Auth
Created by Json 👺 on 2/1/2025 in #help
Has anyone used getSession() with tRPC callers?
Implemented from your docs today. Very helpful.
14 replies
PPrisma
Created by Json 👺 on 12/6/2024 in #help-and-questions
Error P1012 when trying to use Prisma Postgres
It is not, but if you shoot me your github email I can share it with you. Currently I am using Neon until I can resolve this.
8 replies
PPrisma
Created by Json 👺 on 12/9/2024 in #help-and-questions
TypedSQL failing during build step
TypeScript is "^5", prisma and prisma client are both "^6.0.1" The console appears to give no insight into this specific issue post-linting:
2024-12-09T19:55:10.610Z eslint:lint-result-cache Persisting cached results: C:\Users\jason\dev\masque\.next\cache\eslint\.cache_12rpit9
2024-12-09T19:55:10.620Z eslint:cli-engine Linting complete in: 82ms
Failed to compile.

./node_modules/.prisma/client/sql/getPostReactionsNoUser.d.ts:6:39
Type error: Type expected.

4 | * @param Post ID
5 | */
> 6 | export const getPostReactionsNoUser: (: string) => $runtime.TypedSql<getPostReactionsNoUser.Parameters, getPostReactionsNoUser.Result>
| ^
7 |
8 | export namespace getPostReactionsNoUser {
9 | export type Parameters = [string]
2024-12-09T19:55:10.610Z eslint:lint-result-cache Persisting cached results: C:\Users\jason\dev\masque\.next\cache\eslint\.cache_12rpit9
2024-12-09T19:55:10.620Z eslint:cli-engine Linting complete in: 82ms
Failed to compile.

./node_modules/.prisma/client/sql/getPostReactionsNoUser.d.ts:6:39
Type error: Type expected.

4 | * @param Post ID
5 | */
> 6 | export const getPostReactionsNoUser: (: string) => $runtime.TypedSql<getPostReactionsNoUser.Parameters, getPostReactionsNoUser.Result>
| ^
7 |
8 | export namespace getPostReactionsNoUser {
9 | export type Parameters = [string]
5 replies
BABetter Auth
Created by Json 👺 on 12/8/2024 in #help
Use deleteUser() without verification?
You're the best thanks
6 replies
BABetter Auth
Created by Json 👺 on 12/8/2024 in #help
Use deleteUser() without verification?
I get the following error, however the session appears to be fresh since I can perform other actions. Do you have a suggested strategy for debugging this?
{
//...
"error": {
"message": "Session is not fresh",
"code": "SESSION_IS_NOT_FRESH",
"status": 403,
"statusText": "Forbidden"
}
}
{
//...
"error": {
"message": "Session is not fresh",
"code": "SESSION_IS_NOT_FRESH",
"status": 403,
"statusText": "Forbidden"
}
}
6 replies
PPrisma
Created by Json 👺 on 12/6/2024 in #help-and-questions
Error P1012 when trying to use Prisma Postgres
Are there any resources on debugging this?
8 replies
PPrisma
Created by Json 👺 on 12/6/2024 in #help-and-questions
Error P1012 when trying to use Prisma Postgres
generator client {
provider = "prisma-client-js"
previewFeatures = ["relationJoins", "typedSql", "omitApi"]
}

datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
previewFeatures = ["relationJoins", "typedSql", "omitApi"]
}

datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
8 replies
PPrisma
Created by Json 👺 on 12/6/2024 in #help-and-questions
Error P1012 when trying to use Prisma Postgres
DATABASE_URL="prisma+postgres://accelerate.prisma-data.net/?api_key=..."

PULSE_API_KEY="..."
DATABASE_URL="prisma+postgres://accelerate.prisma-data.net/?api_key=..."

PULSE_API_KEY="..."
These are the two keys Prisma Postgres provides me during setup. I have no other keys that might conflict.
8 replies
BABetter Auth
Created by Json 👺 on 11/30/2024 in #bug-reports
Unable to use `mongodb` client
Great I got it working. Thanks
3 replies
BABetter Auth
Created by Json 👺 on 11/2/2024 in #bug-reports
Failed to get source map when using auth.api.getSession() during first request
Here is the provider and hook solution I came up with if you ever consider adding a Next.js specific example to the docs or any other Server Component framework @/components/providers/session-provider.tsx
"use client";

import { useQuery, UseQueryResult } from "@tanstack/react-query";
import { getSession } from "@/lib/auth-client";
import { Session } from "@/lib/auth-client"; // Explicitly inferred type
import React, { useContext } from "react";

type SessionContextType = UseQueryResult<Session | null, Error>;
const SessionContext = React.createContext<SessionContextType | undefined>(
undefined,
);

type SessionProviderProps = {
initialData: Session | null;
children: React.ReactNode;
};

export function SessionProvider({
initialData,
children,
}: SessionProviderProps) {
const query = useQuery({
queryKey: ["session"],
queryFn: async () => {
const result = await getSession();
if (result.error) {
throw new Error(result.error.message || "Failed to fetch session");
}
return result.data;
},
staleTime: Infinity,
initialData: initialData,
});

return (
<SessionContext.Provider value={query}>{children}</SessionContext.Provider>
);
}

export const useSession = (): SessionContextType => {
const sessionContext = useContext(SessionContext);
if (sessionContext === undefined) {
throw new Error("useSession must be used within SessionProvider");
}
return sessionContext;
};
"use client";

import { useQuery, UseQueryResult } from "@tanstack/react-query";
import { getSession } from "@/lib/auth-client";
import { Session } from "@/lib/auth-client"; // Explicitly inferred type
import React, { useContext } from "react";

type SessionContextType = UseQueryResult<Session | null, Error>;
const SessionContext = React.createContext<SessionContextType | undefined>(
undefined,
);

type SessionProviderProps = {
initialData: Session | null;
children: React.ReactNode;
};

export function SessionProvider({
initialData,
children,
}: SessionProviderProps) {
const query = useQuery({
queryKey: ["session"],
queryFn: async () => {
const result = await getSession();
if (result.error) {
throw new Error(result.error.message || "Failed to fetch session");
}
return result.data;
},
staleTime: Infinity,
initialData: initialData,
});

return (
<SessionContext.Provider value={query}>{children}</SessionContext.Provider>
);
}

export const useSession = (): SessionContextType => {
const sessionContext = useContext(SessionContext);
if (sessionContext === undefined) {
throw new Error("useSession must be used within SessionProvider");
}
return sessionContext;
};
../layout.tsx
import { SessionProvider } from "./session-provider";
import { auth } from "@/lib/auth";
import { headers } from "next/headers";

export default async function Providers({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
const session = await auth.api.getSession({
headers: await headers(),
});

return (
<>
...
<SessionProvider initialData={session}>{children}</SessionProvider>
</>
);
}
import { SessionProvider } from "./session-provider";
import { auth } from "@/lib/auth";
import { headers } from "next/headers";

export default async function Providers({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
const session = await auth.api.getSession({
headers: await headers(),
});

return (
<>
...
<SessionProvider initialData={session}>{children}</SessionProvider>
</>
);
}
36 replies
BABetter Auth
Created by Json 👺 on 11/2/2024 in #bug-reports
Failed to get source map when using auth.api.getSession() during first request
Ahhh, sorry about that... you've been very helpful, by the way. My money is on Better-Auth. Definitely all in at this point
36 replies
BABetter Auth
Created by Json 👺 on 11/2/2024 in #bug-reports
Failed to get source map when using auth.api.getSession() during first request
This is what is kind of confusing because session is just the Session itself, but the return type of this function is Session and User
36 replies
BABetter Auth
Created by Json 👺 on 11/2/2024 in #bug-reports
Failed to get source map when using auth.api.getSession() during first request
type SessionProviderProps = {
initialData: ReturnType<typeof getSession>;
children: React.ReactNode;
};

const query = useQuery({
queryKey: ["session"],
queryFn: async () => getSession(),
staleTime: Infinity, // Maybe change
initialData: initialData,
});
type SessionProviderProps = {
initialData: ReturnType<typeof getSession>;
children: React.ReactNode;
};

const query = useQuery({
queryKey: ["session"],
queryFn: async () => getSession(),
staleTime: Infinity, // Maybe change
initialData: initialData,
});
Is this appropriate?
36 replies