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 }); }
Recent Announcements
Continue the conversation
Join the Discord to ask follow-up questions and connect with the community
W
Wasp
Rails-like framework for React, Node.js and Prisma. Build your app in a day and deploy it with a single CLI command.