Kynetix
WWasp
•Created by Webby Vanderhack on 4/4/2025 in #🙋questions
Is it possible to dynamically import a static client asset from the server?
@franjo thanks, that's what I ended up doing.
18 replies
WWasp
•Created by Kynetix on 4/24/2025 in #🙋questions
Call custom api externally
Thanks, that works great man!
39 replies
WWasp
•Created by Webby Vanderhack on 4/4/2025 in #🙋questions
Is it possible to dynamically import a static client asset from the server?
@kapa.ai I'm building a chatbot where the api handles the heavy load (LLM setup, etc), and I have the system prompts in a text file on the server. I tried fs.readFile(dirname + 'instructions.txt'), but it says that "dirname is not defined".
After doing the following
import { fileURLToPath } from 'url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
that fixed it, however it seems that the file isn't deployed when testing, because it's looking in .wasp/out/server/bundle/.... and the file isn't there.
What's the best way to go about this?
18 replies
WWasp
•Created by Kynetix on 4/24/2025 in #🙋questions
Call custom api externally
@franjo the chatbot embedded in Wasp is kinda sandboxed - it can't access the applications variables & stuff, (except via some vars defined within). So it's as good as sending the data from a different application.
Basically, I generate the token in Wasp and pass it to the chatbot, then when the chatbot calls the Wasp API, it passes the token (Authorization: Bearer XXXXXX) in the header.
39 replies
WWasp
•Created by Kynetix on 4/24/2025 in #🙋questions
Call custom api externally
@kapa.ai Since wasp has moved from JWT to sessions, how can I implement this session for external API calling? How can I convert this JWT approach I was implementing to a session based approach? Or do you have a better suggestion?
39 replies
WWasp
•Created by Kynetix on 4/24/2025 in #🙋questions
Call custom api externally
@kapa.ai I've written the following for creating a token:
// BEGIN function
export const createToken: CreateToken<{}, { status: string; data: string }> = (req, res, context) => {
if (!context.user) {
throw new HttpError(401);
}
try {
// Create a JWT token with user id and email, expires in 1 hour
const payload = {
id: context.user.id,
email: context.user.email,
username: context.user.username,
};
const secret = process.env.JWT_SECRET || 'zigozi_default_secret';
const token = jwt.sign(payload, secret, { expiresIn: '6h' });
res.json({ status: 'success', data:token });
} catch (error: unknown) {
let errorMessage = 'Error creating token';
if (error instanceof Error) {
errorMessage = error.message;
}
res.status(500).json({ status: 'error', data: errorMessage });
}
};
// END createToken
and the generated token, I used it in the header of a fetch() call to the api like this
// begin HEADER
{
'Content-Type': 'application/json',
'Authorization': 'Bearer ' + $vars.jwtToken
},
// end HEADER
But it responds with
{
"message": "Invalid credentials",
"data": {}
}
Why is it saying "invalid credentials"? How can I rectify this?
39 replies
WWasp
•Created by Kynetix on 4/24/2025 in #🙋questions
Call custom api externally
The alternative would've been to call Supabase Edge functions, but I'm not too familiar with them (especially in terms of security)
39 replies
WWasp
•Created by Kynetix on 4/24/2025 in #🙋questions
Call custom api externally
hi @franjo , I embedded a Flowise chatbot that queries the user, and the answers are http-POSTed to the external API (which saves the data to a Supabase db).
39 replies
WWasp
•Created by Kynetix on 4/24/2025 in #🙋questions
Call custom api externally
@kapa.ai please show me the implementation steps and an example custom API endpointsnfor generating JWT tokens
39 replies
WWasp
•Created by Kynetix on 4/24/2025 in #🙋questions
Call custom api externally
@kapa.ai I'm using the built-in authentication. How can I retrieve the token after the user logs in?
39 replies
WWasp
•Created by Kynetix on 4/24/2025 in #🙋questions
Call custom api externally
@kapa.ai I'm using the built-in authentication. How can I retrieve the token after the user logs in?
39 replies
WWasp
•Created by paulo.langer on 7/17/2024 in #🙋questions
Supabase Auth
Hi, were you able to get this sorted out? I'm building a Saas with supabase as well and trying to decide which auth to use - Supabase or Opensaas'. What are the pros and cons of each?
10 replies
WWasp
•Created by Kynetix on 2/23/2025 in #🙋questions
cannot find module /auth/ui
Thanks, but that search yielded nothing.
Got it sorta fixed by, among other things, replacing {children} with <Outlet /> in src/client/App.tsx, and deleting node_modules & package-lock.json, then npm install.
Also had some errors like
"Pre-transform error: [postcss] It looks like you're trying to use
tailwindcss
directly as a PostCSS plugin. The PostCSS plugin has moved to a separate package, so to continue using Tailwind CSS with PostCSS you'll need to install @tailwindcss/postcss
and update your PostCSS configuration."12 replies
WWasp
•Created by Kynetix on 2/23/2025 in #🙋questions
cannot find module /auth/ui
Any idea which server file I should check? I never touched any other files during the upgrade, except following the upgrade instructions on the Wasp site 🙂
12 replies
WWasp
•Created by Kynetix on 2/23/2025 in #🙋questions
cannot find module /auth/ui
Sorry about the delay in response. Juggling 3-4 different projects at once is no easy task!
Here's the error log:
[ Client ] ➜ Local: http://localhost:3000/
[ Client ] ➜ Network: http://192.168.4.65:3000/
[ Client ] ➜ Network: http://100.64.214.27:3000/
[ Client ] ➜ press h + enter to show help
[ Server ]
[ Server ] > [email protected] start
[ Server ] > node --enable-source-maps -r dotenv/config bundle/server.js
[ Server ]
[ Server!] node:internal/modules/esm/resolve:264
[ Server!] throw new ERR_MODULE_NOT_FOUND(
[ Server!] ^
[ Server!]
[ Server!] Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/Users/obinnaezeilo/Projects/ai/opensaas/docfolio/app/.wasp/out/sdk/wasp/dist/client/auth/ui' imported from /Users/obinnaezeilo/Projects/ai/opensaas/docfolio/app/.wasp/out/sdk/wasp/dist/client/auth/index.js
[ Server!] at finalizeResolution (node:internal/modules/esm/resolve:264:11)
[ Server!] at moduleResolve (node:internal/modules/esm/resolve:917:10)
[ Server!] at defaultResolve (node:internal/modules/esm/resolve:1130:11)
[ Server!] at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:396:12)
[ Server!] at ModuleLoader.resolve (node:internal/modules/esm/loader:365:25)
[ Server!] at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:240:38)
[ Server!] at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:85:39)
[ Server!] at link (node:internal/modules/esm/module_job:84:36) {
[ Server!] code: 'ERR_MODULE_NOT_FOUND',
[ Server!] url: 'file:///Users/obinnaezeilo/Projects/ai/opensaas/docfolio/app/.wasp/out/sdk/wasp/dist/client/auth/ui'
[ Server!] }
[ Server!]
[ Server!] Node.js v20.11.1
12 replies
WWasp
•Created by Kynetix on 2/8/2025 in #🙋questions
Port 5432 is already in use
Thanks, I figured it out. I didn't know about the DATABASE_URL option before 🙂
Thanks
10 replies
WWasp
•Created by Kynetix on 2/8/2025 in #🙋questions
Port 5432 is already in use
I've added the DATABASE_URL to the .env.server, but when I run wasp start db, I get the error "Wasp has detected that you have defined DATABASE_URL env var in your .env.server file.
To have Wasp run the dev database for you, make sure you remove that env var first."
Should I run a different command instead?
10 replies
WWasp
•Created by Kynetix on 10/28/2024 in #🙋questions
Display app version in UI
Thanks, @martinsos that was it.
export const getAppVersion = () => {
return process.env.npm_package_version;
} // works great. Thanks a lot
14 replies
WWasp
•Created by Kynetix on 10/28/2024 in #🙋questions
Display app version in UI
@kapa.ai thanks for the feedback. Is there an alternate way to track the app's version? I want to be maintaining the versions when I publish to git, and have the version number displayed on the UI. It doesn't have to be in package.json
14 replies
WWasp
•Created by Kynetix on 10/23/2024 in #🙋questions
File is not defined
I'm guessing you guys are the developers of Wasp? Great job guys!!
23 replies