vance_solar
vance_solar
WWasp
Created by vance_solar on 2/22/2025 in #đŸ™‹questions
Custom Aliases don't work after migrating from 0.15 to 0.16
I recently upgraded to Wasp v0.16 because I wanted to take advantage of the custom aliases. I installed shadcn using this guide, and got it working after swapping out the import paths and such as suggested. The problem is every time I add a new shadcn component the paths get written incorrectly and I have to go fix it. So I tried switching back to using aliases and Wasp just fails to compile with errors like Cannot find module '@/lib/utils' or its corresponding type declarations. The aliases are recognized by VSCode without any problems so I'm not sure why wasp is failing on this. Below are my settings main.wasp
app OpenSaaS {
wasp: {
version: "^0.16.0"
},
...
app OpenSaaS {
wasp: {
version: "^0.16.0"
},
...
tsconfig.json
{
"compilerOptions": {
"module": "esnext",
"target": "esnext",
"moduleResolution": "bundler",
"jsx": "preserve",
"strict": true,
"esModuleInterop": true,
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"typeRoots": [
"node_modules/@testing-library",
"node_modules/@types"
],
"composite": true,
"skipLibCheck": true,
"outDir": ".wasp/out/user",
"rootDir": "../", //allow importing of shared dir
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
},
"include": [
"src"
],
}
{
"compilerOptions": {
"module": "esnext",
"target": "esnext",
"moduleResolution": "bundler",
"jsx": "preserve",
"strict": true,
"esModuleInterop": true,
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"typeRoots": [
"node_modules/@testing-library",
"node_modules/@types"
],
"composite": true,
"skipLibCheck": true,
"outDir": ".wasp/out/user",
"rootDir": "../", //allow importing of shared dir
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
},
"include": [
"src"
],
}
components.json
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "default",
"rsc": false,
"tsx": true,
"tailwind": {
"config": "tailwind.config.cjs",
"css": "index.css",
"baseColor": "gray",
"cssVariables": true,
"prefix": ""
},
"aliases": {
"components": "@/components",
"utils": "@/lib/utils",
"ui": "@/components/ui",
"lib": "@/lib",
"hooks": "@/hooks"
},
"iconLibrary": "lucide"
}
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "default",
"rsc": false,
"tsx": true,
"tailwind": {
"config": "tailwind.config.cjs",
"css": "index.css",
"baseColor": "gray",
"cssVariables": true,
"prefix": ""
},
"aliases": {
"components": "@/components",
"utils": "@/lib/utils",
"ui": "@/components/ui",
"lib": "@/lib",
"hooks": "@/hooks"
},
"iconLibrary": "lucide"
}
22 replies
WWasp
Created by vance_solar on 2/2/2025 in #đŸ™‹questions
Is it possible to inject custom data into the context object with middleware?
I'm looking to implement the concept of Organizations with Roles and Permissions. I've seen this gist linked in a few discussions which seems like a nice starting point for how to organize the DB schema. I'm trying to figure out the best way to implement the backend. My current thought is to write custom middleware to check the user's selected organization and enrich the context object with the user's role and permissions to be passed into my Queries and Actions. If the user is not enrolled in the organization then the middleware would reject the request. Is this possible with Wasp? If not, any suggestions for the best way to approach this the "Wasp way"? I'd like to avoid writing custom apis for everything.
31 replies
WWasp
Created by vance_solar on 1/2/2025 in #đŸ™‹questions
How do I access full request object (headers, ip address, user agent) in backend functions?
Hi, I need to be able to use information from the request headers to perform different logic. For wasp actions I only see the option of getting the request body, and the context only contains db entities and the logged in user. Is there a way to get full access to the headers like useragent, ip address, etc?
7 replies