A 500 error without exception log stream

Hi, I am facing an exception without explicit error messages in logstream. Do you have any idea to find the culprit? Thanks
My code snippet is:
import jwt from '@tsndr/cloudflare-worker-jwt';
import { google } from "worker-auth-providers";
export const runtime = 'edge';

function generateJWT(user: any, secret: string) {
    const claims: any = {
        user_id: user?.id,
    };
    console.log("[claims, scret]", claims, secret);
    return jwt.sign({ exp: Math.floor(Date.now() / 1000) + (30* 24 * (60 * 60)), ...claims }, secret, { algorithm: 'HS256' });
}

async function createUser(user: any) {
    const profile = {
        id: user.id,
        name: user.name,
        image: user.picture,
        email: user.email,
    };
    //@ts-ignore
    return await WORKER_AUTH_PROVIDERS_STORE.put(`google_${user.id}`, JSON.stringify(profile));
}

export default async function onRequestGet(request:Request) {
    try {
        const { user: providerUser } = await google.users({
            options: {
                clientId: process.env.GOOGLE_CLIENT_ID as string,
                clientSecret: process.env.GOOGLE_CLIENT_SECRET as string,
                redirectUrl: process.env.GOOGLE_REDIRECT_PROD_URL as string,
            },
            request,
        });
        console.log('[providerUser]', providerUser);
        await createUser(providerUser);
        const jwt = generateJWT(providerUser, process.env.ENCODE_JWT_TOKEN as string);
        console.log("[jwt]", jwt);
        const now = new Date();
        now.setTime(now.getTime() + 24 * 3600 * 1000);
        return new Response(
            null,
            {
                status: 302,
                headers: {
                    location: "/me",
                    "Set-Cookie": `__Session-worker.auth.providers-token=${jwt}; 

......
Was this page helpful?