Jonathan
Jonathan
Explore posts from servers
PPrisma
Created by Jonathan on 6/12/2024 in #help-and-questions
Connection Pooling issues with Azure SQL
Yeah I have a few thousand active users at a time generally and I am doing something like this in the nextjs app
import { PrismaClient } from "@prisma/client";

import { env } from "@/env";

const globalForPrisma = globalThis as unknown as {
prisma: PrismaClient | undefined;
};

export const db =
globalForPrisma.prisma ??
new PrismaClient({
log:
env.NODE_ENV === "development" ? ["query", "error", "warn"] : ["error"],
});

if (env.NODE_ENV !== "production") globalForPrisma.prisma = db;
import { PrismaClient } from "@prisma/client";

import { env } from "@/env";

const globalForPrisma = globalThis as unknown as {
prisma: PrismaClient | undefined;
};

export const db =
globalForPrisma.prisma ??
new PrismaClient({
log:
env.NODE_ENV === "development" ? ["query", "error", "warn"] : ["error"],
});

if (env.NODE_ENV !== "production") globalForPrisma.prisma = db;
8 replies
PPrisma
Created by Jonathan on 6/24/2024 in #help-and-questions
Ensuring Filtering if variable is undefined
Yeah I agree it is a "we have to live with it" but would be nice if there was a better way sometimes I tend to do the second approach
6 replies
PPrisma
Created by Jonathan on 6/12/2024 in #help-and-questions
Connection Pooling issues with Azure SQL
ok thanks
8 replies
PPrisma
Created by Jonathan on 6/12/2024 in #help-and-questions
Connection Pooling issues with Azure SQL
ok I will give it a try
8 replies
TtRPC
Created by Jonathan on 5/16/2024 in #❓-help
TRPC completely broke
So fairly long but this was all working and now it isn't
5 replies
TtRPC
Created by Jonathan on 5/16/2024 in #❓-help
TRPC completely broke
The request URL looks something like this:
http://localhost:3000/api/trpc/conversations.grid,conversations.count,conversations.count,conversations.count?batch=1&input=%7B%220%22%3A%7B%22json%22%3A%7B%22GridParams%22%3A%7B%22skip%22%3A0%2C%22take%22%3A20%7D%2C%22inboxType%22%3A%22mine%22%2C%22closed%22%3Afalse%2C%22sort%22%3A%22Newest%22%7D%7D%2C%221%22%3A%7B%22json%22%3A%7B%22inboxType%22%3A%22mine%22%7D%7D%2C%222%22%3A%7B%22json%22%3A%7B%22inboxType%22%3A%22unassigned%22%7D%7D%2C%223%22%3A%7B%22json%22%3A%7B%22inboxType%22%3A%22all%22%7D%7D%7D
http://localhost:3000/api/trpc/conversations.grid,conversations.count,conversations.count,conversations.count?batch=1&input=%7B%220%22%3A%7B%22json%22%3A%7B%22GridParams%22%3A%7B%22skip%22%3A0%2C%22take%22%3A20%7D%2C%22inboxType%22%3A%22mine%22%2C%22closed%22%3Afalse%2C%22sort%22%3A%22Newest%22%7D%7D%2C%221%22%3A%7B%22json%22%3A%7B%22inboxType%22%3A%22mine%22%7D%7D%2C%222%22%3A%7B%22json%22%3A%7B%22inboxType%22%3A%22unassigned%22%7D%7D%2C%223%22%3A%7B%22json%22%3A%7B%22inboxType%22%3A%22all%22%7D%7D%7D
5 replies
CC#
Created by Jonathan on 5/6/2024 in #help
Error Accessing a User in Blazor
So I found that it is something wrong with safari and the cookies or storage on my machine, I cleaned everything and it is running fine
26 replies
CC#
Created by Jonathan on 5/6/2024 in #help
Error Accessing a User in Blazor
yeah yours is working let me see if I can find the differences
26 replies
CC#
Created by Jonathan on 5/6/2024 in #help
Error Accessing a User in Blazor
yeah lets try that
26 replies
CC#
Created by Jonathan on 5/6/2024 in #help
Error Accessing a User in Blazor
yeah that is working
26 replies
CC#
Created by Jonathan on 5/6/2024 in #help
Error Accessing a User in Blazor
I tried it on another computer and the same thing from a completely new project and made sure the only thing I did was replace the Home.razor
26 replies
CC#
Created by Jonathan on 5/6/2024 in #help
Error Accessing a User in Blazor
Maybe I am completely going this the wrong way, I just need to get my current user so I can ensure it is filtered down to their data
26 replies
CC#
Created by Jonathan on 5/6/2024 in #help
Error Accessing a User in Blazor
But if you go to the page https://localhost:7126/Account/Manage it is obviously working
26 replies
CC#
Created by Jonathan on 5/6/2024 in #help
Error Accessing a User in Blazor
and no go
26 replies
CC#
Created by Jonathan on 5/6/2024 in #help
Error Accessing a User in Blazor
right, I tried adding:
builder.Services.AddHttpContextAccessor();
builder.Services.AddHttpContextAccessor();
26 replies
CC#
Created by Jonathan on 5/6/2024 in #help
Error Accessing a User in Blazor
to match this:
@page "/"
@using ExampleIssues.Components.Account
@using ExampleIssues.Data
@inject IdentityUserAccessor UserAccessor

<PageTitle>Home</PageTitle>

<h1>Hello, world!</h1>

Welcome to your new app.

@if (user != null)
{
<div>User here: @user.UserName</div>
}
else
{
<div>User Not found</div>
}

@code {

private ApplicationUser user = default!;

[CascadingParameter] private HttpContext HttpContext { get; set; } = default!;
protected override async Task OnInitializedAsync()
{
user = await UserAccessor.GetRequiredUserAsync(HttpContext);
}
}
@page "/"
@using ExampleIssues.Components.Account
@using ExampleIssues.Data
@inject IdentityUserAccessor UserAccessor

<PageTitle>Home</PageTitle>

<h1>Hello, world!</h1>

Welcome to your new app.

@if (user != null)
{
<div>User here: @user.UserName</div>
}
else
{
<div>User Not found</div>
}

@code {

private ApplicationUser user = default!;

[CascadingParameter] private HttpContext HttpContext { get; set; } = default!;
protected override async Task OnInitializedAsync()
{
user = await UserAccessor.GetRequiredUserAsync(HttpContext);
}
}
26 replies
CC#
Created by Jonathan on 5/6/2024 in #help
Error Accessing a User in Blazor
I just created a new blank project again, and the only thing i changed was the home page
26 replies
CC#
Created by Jonathan on 5/6/2024 in #help
Error Accessing a User in Blazor
If you login and go to the home page, it just loops
26 replies
CC#
Created by Jonathan on 5/6/2024 in #help
Error Accessing a User in Blazor
I replaced my App.razor with that and it just goes in a loop of reloading
26 replies
TTCTheo's Typesafe Cult
Created by Jonathan on 2/4/2024 in #questions
T3 Stack with React Native and Multiple NextJS with Turbo & Clerk
which helped a lot.
6 replies