Shiba Bop
Shiba Bop
Explore posts from servers
DTDrizzle Team
Created by Shiba Bop on 6/23/2024 in #help
Drizzle Kit studio error
ok so the reason it was happening, I had sessionTable defined on different schemas, and drizzle-kit studio didnt know what to do with 2 matching tables even though they are on different schemas
2 replies
SSolidJS
Created by Shiba Bop on 6/8/2024 in #support
access event.locals from a server function
appendHeader and getHeader did help somewhat but it was an order of operations issue, I ended up doing this:
export default createMiddleware({
onRequest: [
async ({ locals, nativeEvent }) => {
locals.pb = new PocketBase(process.env.SECURE_PB_URL);

locals.pb.authStore.loadFromCookie(
getHeader(nativeEvent, 'cookie') || ''
);

try {
locals.pb.authStore.isValid &&
(await locals.pb.collection('users').authRefresh());
} catch {
locals.pb.authStore.clear();
}
}
],
onBeforeResponse: [
async ({ locals, request, nativeEvent }) => {
appendHeader(
nativeEvent,
'set-cookie',
locals.pb.authStore.exportToCookie({
secure: false
})
);
}
]
});
export default createMiddleware({
onRequest: [
async ({ locals, nativeEvent }) => {
locals.pb = new PocketBase(process.env.SECURE_PB_URL);

locals.pb.authStore.loadFromCookie(
getHeader(nativeEvent, 'cookie') || ''
);

try {
locals.pb.authStore.isValid &&
(await locals.pb.collection('users').authRefresh());
} catch {
locals.pb.authStore.clear();
}
}
],
onBeforeResponse: [
async ({ locals, request, nativeEvent }) => {
appendHeader(
nativeEvent,
'set-cookie',
locals.pb.authStore.exportToCookie({
secure: false
})
);
}
]
});
and it works!
7 replies
SSolidJS
Created by Shiba Bop on 6/8/2024 in #support
access event.locals from a server function
it doesnt seem to actually set the cookie
7 replies
SSolidJS
Created by Shiba Bop on 6/8/2024 in #support
access event.locals from a server function
im actually having issue with this line
response.headers.append(
'set-cookie',
locals.pb.authStore.exportToCookie()
);
response.headers.append(
'set-cookie',
locals.pb.authStore.exportToCookie()
);
7 replies
SSolidJS
Created by Shiba Bop on 6/8/2024 in #support
access event.locals from a server function
that was it thanks!
7 replies