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,
    }),
  );
};
Was this page helpful?