Kynetix
WWasp-lang
•Created by Kynetix on 10/16/2024 in #đŸ™‹questions
process is not defined
I'm building a chatbot SAAS using OpenSAAS. I created the app files (.tsx and operations.ts) in its own folder, just like the demo app. I also stored some API keys in .env.server, and I'm trying to access them in operations.ts via process.env, but when I run it, it always errors saying "process is not defined" (dev console points to config.ts), but the demo app (which also uses process.env) works fine.
Can anyone help? Is there a step I'm missing?
Here's a snippet of code trying to access OpenAI's key
function setupOpenAI() {
if (!import.meta.env.REACT_APP_OPENAI_API_KEY) {
return new HttpError(500, 'OpenAI API key is not set');
}
return new OpenAI({ apiKey: import.meta.env.REACT_APP_OPENAI_API_KEY });
}
14 replies