Typedef
Typedef
Explore posts from servers
TTCTheo's Typesafe Cult
Created by Typedef on 9/17/2024 in #questions
_error.tsx on nextjs pages
Do you guys know if its possible to make a custom page for Vercel serverless timeouts, I tried _error and 500 on pages folder doesnt seem to work. Existing discussion on Vercel's github doesnt have replies either.
2 replies
PPrisma
Created by Typedef on 8/2/2024 in #help-and-questions
I/O error: Device or resource busy
I'm getting this error sometimes, what does it mean?
{
"success": false,
"message": "\nInvalid `prisma.pickaxeUser.findUnique()` invocation:\n\n\nRaw query failed. Code: `unknown`. Message: `Kind: I/O error: Device or resource busy (os error 16), labels: {\"RetryableWriteError\"}`"
}
{
"success": false,
"message": "\nInvalid `prisma.pickaxeUser.findUnique()` invocation:\n\n\nRaw query failed. Code: `unknown`. Message: `Kind: I/O error: Device or resource busy (os error 16), labels: {\"RetryableWriteError\"}`"
}
Kind: Server selection timeout: No available servers.
2 replies
PPrisma
Created by Typedef on 6/5/2024 in #help-and-questions
default value not changing
I changed the default value of one of my fields on the schema but it doesnt propagate even if i generate the schema again? example showPricingBgImage Boolean @default(true) to showPricingBgImage Boolean @default(false) when querying the data that has no showPricingBgImage
4 replies
TTCTheo's Typesafe Cult
Created by Typedef on 3/5/2024 in #questions
AccessDenied NextAuth
No description
2 replies
TTCTheo's Typesafe Cult
Created by Typedef on 2/14/2024 in #questions
NextAuth vercel preview getserversession returns null
I'm using next pages, My getserversession on trpc createContext is returning null on preview deployments, anyone know why this is? useSession gets the right session tho
2 replies
TTCTheo's Typesafe Cult
Created by Typedef on 11/21/2023 in #questions
Vercel Out of memory event error
No description
2 replies
TTCTheo's Typesafe Cult
Created by Typedef on 10/5/2023 in #questions
NextJS app in a wordpress subdirectory
How would i deploy a Nextjs App on a wordpress subdirectory? any ideas?
2 replies
PPrisma
Created by Typedef on 9/30/2023 in #help-and-questions
Edge + Accelerate cold start
Is there coldstart with edge + accelerate? it takes like 10 seconds for my query to get a result is this normal? Any way to speed it up?
25 replies
TTCTheo's Typesafe Cult
Created by Typedef on 9/20/2023 in #questions
Selecting through transparent background KonvaJS
No description
4 replies
TTCTheo's Typesafe Cult
Created by Typedef on 9/14/2023 in #questions
WordPress Landing + NextJS Dashboard
What’s the best way to combine a wordpress landing page to a nextjs dashboard with the same domain? Wordpress -> domain.com NextJS Dashboard -> app.domain.com
6 replies
TTCTheo's Typesafe Cult
Created by Typedef on 9/5/2023 in #questions
TRPC's useContext does not invalidate query.
No description
4 replies
TTCTheo's Typesafe Cult
Created by Typedef on 9/1/2023 in #questions
TRPC The inferred type of this node exceeds the maximum length the compiler will serialize.
No description
3 replies
TtRPC
Created by Typedef on 8/31/2023 in #❓-help
The inferred type of this node exceeds the maximum length the compiler will serialize.
No description
10 replies
TtRPC
Created by Typedef on 8/10/2023 in #❓-help
useContext not Invalidating
What are the possible mistakes if useContext wont invalidate when doing the following:
const utils = trpc.useContext();
const user = trpc.user.getUser.useQuery();
const updateUser = trpc.user.updateUser.useMutation({
onSuccess: () => {
utils.user.getUser.invalidate();
}
});
const utils = trpc.useContext();
const user = trpc.user.getUser.useQuery();
const updateUser = trpc.user.updateUser.useMutation({
onSuccess: () => {
utils.user.getUser.invalidate();
}
});
Used to work before but stopped working when I turned my entire repo to turborepo.
15 replies
TTCTheo's Typesafe Cult
Created by Typedef on 8/1/2023 in #questions
Redux reducer type error
3 replies
TTCTheo's Typesafe Cult
Created by Typedef on 7/26/2023 in #questions
NextAuth manual email verification
Im trying to implement manual email verification. So I created a VerificationToken with the identifier and token but when going to the link I'm always getting an error.
http://localhost:3000/api/auth/callback/email?callbackUrl=http%3A%2F%2Flocalhost%3A3000%2Fapp%2Fdashboard&token=rbaykgmrwek9nhpocro27emr1uobwq5axonlq4ykarg080jj9byjxub5bt7ztj2i&email=[EMAIL]
http://localhost:3000/api/auth/callback/email?callbackUrl=http%3A%2F%2Flocalhost%3A3000%2Fapp%2Fdashboard&token=rbaykgmrwek9nhpocro27emr1uobwq5axonlq4ykarg080jj9byjxub5bt7ztj2i&email=[EMAIL]
Am I not doing it correctly? Dont I just need to create a verification token in the database and replace the query params?
2 replies
TTCTheo's Typesafe Cult
Created by Typedef on 7/26/2023 in #questions
NextAuth getting session token in the backend.
Is there a way to get the session token in the backend? whats the best way to do this? Edit: got it from req
2 replies
TTCTheo's Typesafe Cult
Created by Typedef on 7/12/2023 in #questions
Generating 1200x1200 10,000 unique images in lambda.
I'm using lambda for this one, I'm generating 1200x1200 10,000 unique images but it reaches the timeout limit. Any recommendation to make this faster? without removing status updates.
// generate images from layers
const canvas = createCanvas(dimension.width, dimension.height);
const ctx = canvas.getContext("2d");

for (let i = 0; i < metadata.length; i++) {
console.info(`<${userId}>`, `generated image #${i}`);
ctx.clearRect(0, 0, dimension.width, dimension.height);

const data = metadata[i];
const traitImages = data.attributes.map((attr) =>
layerMap.get(attr.trait_type + attr.value),
);

for (const image of traitImages) {
ctx.drawImage(image, 0, 0, dimension.width, dimension.height);
}

archive.append(canvas.toBuffer("image/png"), { name: `images/${i}.${format}` });

// if divisible by 5 update status
if (i % 5 === 0) {
await collection.updateOne({ userId }, { $set: { status: i.toString() } });
}
}
console.info(`<${userId}>`, "generated images");
await collection.updateOne({ userId }, { $set: { status: "processed" } });
// generate images from layers
const canvas = createCanvas(dimension.width, dimension.height);
const ctx = canvas.getContext("2d");

for (let i = 0; i < metadata.length; i++) {
console.info(`<${userId}>`, `generated image #${i}`);
ctx.clearRect(0, 0, dimension.width, dimension.height);

const data = metadata[i];
const traitImages = data.attributes.map((attr) =>
layerMap.get(attr.trait_type + attr.value),
);

for (const image of traitImages) {
ctx.drawImage(image, 0, 0, dimension.width, dimension.height);
}

archive.append(canvas.toBuffer("image/png"), { name: `images/${i}.${format}` });

// if divisible by 5 update status
if (i % 5 === 0) {
await collection.updateOne({ userId }, { $set: { status: i.toString() } });
}
}
console.info(`<${userId}>`, "generated images");
await collection.updateOne({ userId }, { $set: { status: "processed" } });
9 replies
TTCTheo's Typesafe Cult
Created by Typedef on 7/11/2023 in #questions
NextAuth dangerous website on email login
I keep getting dangerous website on chrome when I click on the url in the login email from email provider. I believe its caused by secure: false from my nodemailer options. I am using outlook's smtp with port 587 and need to turn off secure false and enable tls instead. Any workarounds?
2 replies
TTCTheo's Typesafe Cult
Created by Typedef on 6/30/2023 in #questions
Need advice on handling 10,000 images on Lambda
I need advice, I have a SQS that triggers lambda, it's an image processor that takes in 10,000 images and archives them in a zip file then uploads it to S3. I'm getting array buffer allocation on the archiving part. I might need more memory, currently has a max of 2560mb ram. This might be happening because I'm putting all the archived objects in a buffer instead of streaming, but it doesnt not work if i stream on lambda.
archive.finalize();
const buffer = [];
archive.on("data", (data => buffer.push(data)));

archive.on('end', (async () => {
const data = Buffer.concat(buffer);

await putObjectToS3(`generator/${userId}/collection.zip`, data);
console.info(`<${userId}>`, "sent zip file to s3");

await collection.updateOne({ userId }, { $set: { status: "completed" } });

resolve(formatResponse({
statusCode: 200,
body: { code: "SUCCESS" },
}))
}))
archive.finalize();
const buffer = [];
archive.on("data", (data => buffer.push(data)));

archive.on('end', (async () => {
const data = Buffer.concat(buffer);

await putObjectToS3(`generator/${userId}/collection.zip`, data);
console.info(`<${userId}>`, "sent zip file to s3");

await collection.updateOne({ userId }, { $set: { status: "completed" } });

resolve(formatResponse({
statusCode: 200,
body: { code: "SUCCESS" },
}))
}))
Should I make two lambda functions one for processing the image and uploading everything to s3, and another one for zipping it?
6 replies