Too many subrequests when im not making 50 subrequests

Domain: yaims.pages.dev Deployment ID: 1c31b0be-ff2f-4486-ac5d-40d9d64f9011 Account ID: e6d556e831514918f99c4e93b57baff7 I am using sveltekit with svelte 5, im 99% sure my code dosent make 50+ subrequests Code
import type { RequestHandler } from "@sveltejs/kit";
import { sql } from "$lib/db";
import bcrypt from "bcryptjs";

export const POST: RequestHandler = async ({ request }) => {
const { email, password } = await request.json();

const user = await sql`SELECT * FROM users WHERE email = ${email}`;

if (!user.length) {
return new Response("Account not found", {
status: 401,
});
}

if (!(await bcrypt.compare(password, user[0].password))) {
return new Response("Invalid password or email", {
status: 401,
});
}

const bytes = new Uint8Array(48);
crypto.getRandomValues(bytes);
const token = btoa(String.fromCharCode(...bytes));

await sql`INSERT INTO sessions (user_id, token) VALUES (${user[0].id}, ${token})`;

return new Response(
JSON.stringify({
user: user[0],
token,
}),
);
};
import type { RequestHandler } from "@sveltejs/kit";
import { sql } from "$lib/db";
import bcrypt from "bcryptjs";

export const POST: RequestHandler = async ({ request }) => {
const { email, password } = await request.json();

const user = await sql`SELECT * FROM users WHERE email = ${email}`;

if (!user.length) {
return new Response("Account not found", {
status: 401,
});
}

if (!(await bcrypt.compare(password, user[0].password))) {
return new Response("Invalid password or email", {
status: 401,
});
}

const bytes = new Uint8Array(48);
crypto.getRandomValues(bytes);
const token = btoa(String.fromCharCode(...bytes));

await sql`INSERT INTO sessions (user_id, token) VALUES (${user[0].id}, ${token})`;

return new Response(
JSON.stringify({
user: user[0],
token,
}),
);
};
3 Replies
Cyteon
CyteonOP•4w ago
Anyone know a solution? I'm 99.99% sure I'm not making 50 subrequests Anyone alive? 😭 anyone?
fry69
fry69•4w ago
Svelte 5 has been released a few days ago and is not yet supported as far as I know. Otherwise I'd start dumb this code down (aka removing libraries etc) until a skeleton works and then start adding things again and see where it breaks.
Cyteon
CyteonOP•4w ago
hm
Want results from more Discord servers?
Add your server