Failed to load resource: the server responded with a status of 413 ()

I tried to do any kind of authorization, both on the server side and on the client side... Everything is unsuccessful. I made a minimal config, but I get this error, as in the screenshot

auth.ts

import { SvelteKitAuth } from '@auth/sveltekit';
import Google from '@auth/sveltekit/providers/google';

export const { handle, signIn } = SvelteKitAuth({
    providers: [Google],
    trustHost: true,
    debug: true,
    useSecureCookies: false,
    callbacks: {
        async session({ session, token }) {
            console.log('session in auth.ts', session, token)
            return session;
        }
    }
});

hooks.server.ts

export { handle } from '$lib/scripts/auth';

In /signin route:

+page.server.ts

import { signIn } from "$lib/scripts/auth"
export const actions = { default: signIn }

+page.svelte

<script lang="ts">
import { SignIn, SignOut } from "@auth/sveltekit/components"
</script>

<SignIn>
      <p>Sign in</p>
    </SignIn>

When I click on the SignIn button, I get what's in the screenshot

The fact is that I am uploading the project to the university's server. There are dev, test, staging and prod environments. And if you run it locally on your computer, then everything works fine. Without a docker. That is, just pnpm run dev. If you run it with docker, in a dev environment, then everything is also fine. But with other environments I get this error. Moreover, the same error occurs when I want to download a large excel file (the application has such functionality). And in the case of dev, everything is ok with the file too. Everything is clear in the case of the file - sveltekit has a built-in limit of 512kB. I changed the variable BODY_SIZE_LIMIT to 2mB. Neither the authorization error nor the file has disappeared. I have no rights to set environment variables, they are set by another person at my request.

When trying to output to +layout.server.ts with the code

import {env} from '$env/dynamic/private';

export async function load({ locals }) {
    console.log('envs', env)

I get this:

envs {
BODY_SIZE_LIMIT: '2M',
...others
}

That is, the variable seems to be there...

My Google Console configurations: 1, 2

This project is incredibly important to me, and tomorrow is the deadline for it... I will be grateful for any help!

Upvotes: 0

Views: 44

Answers (0)

Related Questions