S
SolidJS2mo ago
Deimos

Empty Password while updating session.

import { createAsync } from "@solidjs/router";
import { updateSession, useSession } from "vinxi/http";

const sessionConfig = {
password: import.meta.env.VITE_SESSION_SECRET,
};

export async function getSession(event) {
'use server'
return await useSession(event, sessionConfig);
}

export async function createUserSession(event, token) {
'use server'
const session = await updateSession(event, sessionConfig, {
token: token
})

return session;
}
import { createAsync } from "@solidjs/router";
import { updateSession, useSession } from "vinxi/http";

const sessionConfig = {
password: import.meta.env.VITE_SESSION_SECRET,
};

export async function getSession(event) {
'use server'
return await useSession(event, sessionConfig);
}

export async function createUserSession(event, token) {
'use server'
const session = await updateSession(event, sessionConfig, {
token: token
})

return session;
}
There is password in session config and it is not empty but it keeps saying Empty password. The error is Error: Empty password at seal (file:///E:/Projects/24FM/node_modules/.pnpm/iron-webcrypto@1.2.1/node_modules/iron-webcrypto/dist/index.js:222:11) at sealSession (file:///E:/Projects/24FM/node_modules/.pnpm/h3@1.11.1/node_modules/h3/dist/index.mjs:1381:24) at updateSession (file:///E:/Projects/24FM/node_modules/.pnpm/h3@1.11.1/node_modules/h3/dist/index.mjs:1369:26) at getSession (file:///E:/Projects/24FM/node_modules/.pnpm/h3@1.11.1/node_modules/h3/dist/index.mjs:1355:11) at async updateSession (file:///E:/Projects/24FM/node_modules/.pnpm/h3@1.11.1/node_modules/h3/dist/index.mjs:1361:60) at async Module.$$function1 (E:/Projects/24FM/src/lib/session.js:21:19) at async eval (E:/Projects/24FM/src/lib/auth.js:32:18) Why is that? Please help me :"(
1 Reply
Costinha
Costinha2mo ago
it is not finding the password used for encrypting the user session, in your case is the VITE_SESSION_SECRET environment variable, is it set in your .env file? oh, i just saw the
import.meta.env
import.meta.env
i dont think vite will handle the environment here, need to check on vinxi docs. you can use
process.env
process.env
it will work just fine