Kofi_anan
Kofi_anan
WWasp
Created by Kofi_anan on 4/28/2025 in #đŸ™‹questions
Service accounts for authenticated calls
following the standards used for opensaas i have created a bunch of operations that first check if its an authenticated user making the call. i.e:
if (!context.user) {
throw new HttpError(401, 'User not authenticated');
}
if (!context.user) {
throw new HttpError(401, 'User not authenticated');
}
however i have a bunch of jobs that also need to use these queries. has anyone come up with any patterns to safely bypass authentication checks i.e through the use of serviceaccounts or rules. im thinking to implement something like this:
// Skip authentication check if called from a server job (context.user will be undefined)
// We can detect if it's a server-side call by checking if context.entities exists but context.user doesn't
const isServerSideCall = !context.user && context.entities;

// Only check authentication for client-side calls
if (!context.user && !isServerSideCall) {
throw new HttpError(401, 'User not authenticated');
}

// Log the source of the call for debugging
if (isServerSideCall) {
console.log('getNewsArticles called from server-side job or process');
} else {
console.log(`getNewsArticles called by user: ${context.user?.id}`);
}
// Skip authentication check if called from a server job (context.user will be undefined)
// We can detect if it's a server-side call by checking if context.entities exists but context.user doesn't
const isServerSideCall = !context.user && context.entities;

// Only check authentication for client-side calls
if (!context.user && !isServerSideCall) {
throw new HttpError(401, 'User not authenticated');
}

// Log the source of the call for debugging
if (isServerSideCall) {
console.log('getNewsArticles called from server-side job or process');
} else {
console.log(`getNewsArticles called by user: ${context.user?.id}`);
}
8 replies
WWasp
Created by Kofi_anan on 4/28/2025 in #đŸ™‹questions
postgresql extention support on fly.io using wasp deploy cli
Hey! has anyone had any luck using pgvector or installing any additional extentions on a fly.io database? what would be ideal is if i can use the wasp cli to specify a custom docker image with pgvector installed during wasp deploy. or does anyone have a better workaround?
8 replies
WWasp
Created by Kofi_anan on 3/2/2025 in #đŸ™‹questions
unable to install '@strapi/client' due to tsconfig builder
unable to install '@strapi/client' due to tsconfig compile settings:
[ Wasp ] src/demo-ai-app/DemoAppPage.tsx(18,24): error TS2307: Cannot find module '@strapi/client' or its corresponding type declarations.
[ Wasp ] There are types at '/.../Documents/commercialNewsApp/commerseNews/app/node_modules/@strapi/client/dist/index.d.ts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'.
[ Wasp ] src/demo-ai-app/DemoAppPage.tsx(18,24): error TS2307: Cannot find module '@strapi/client' or its corresponding type declarations.
[ Wasp ] There are types at '/.../Documents/commercialNewsApp/commerseNews/app/node_modules/@strapi/client/dist/index.d.ts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'.
8 replies