mb23
WWasp-lang
•Created by mb23 on 9/17/2024 in #🙋questions
How can i avoid that a user can "signup" twice with the same email address?
At the moment, it's possible for users to sign up with the same email address and still get this confirmation message on the signup page:
You've signed up successfully! Check your email for the confirmation link.
In the database, nothing changes if the email address already exists but how can I check upfront as part of the sign up process if the email address already exists?
28 replies
WWasp-lang
•Created by mb23 on 9/16/2024 in #🙋questions
What's the easiest way to add a live chat script?
I'm wondering what's the easiest way to provide a live chat via an external JS script across all of my app pages? Do I have to include it in App.tsx? 🙂
5 replies
WWasp-lang
•Created by mb23 on 9/12/2024 in #🙋questions
User is logged out quite quickly
Hi there, is there a way to avoid that users are logged out quite quickly?
Often, it happens that users have to log in again after a short time.
9 replies
WWasp-lang
•Created by mb23 on 8/28/2024 in #🙋questions
Deploying Migration fails
During the server build process, I keep getting this error message:
[email protected] db-migrate-prod prisma migrate deploy --schema=../db/schema.prismaPrisma schema loaded from ../db/schema.prisma Datasource "db": PostgreSQL database "railway", schema "public" at "monorail.proxy.rlwy.net:44462" 38 migrations found in prisma/migrations Error: P3009 migrate found failed migrations in the target database, new migrations will not be applied. Read more about how to resolve migration issues in a production database: https://pris.ly/d/migrate-resolve The
20240827213607_27082024
migration started at 2024-08-28 04:47:15.491352 UTC failed
Somehow, yesterday's migration failed and now, I don't really know how to remove this migration. I've already created a new migration and on my local machine, everything works fine. Only if I want to deploy to Railway, I got this error message.12 replies
WWasp-lang
•Created by mb23 on 8/8/2024 in #🙋questions
Best way to use jobs/workers
I've created jobs/workers for most of the functions that are using external APIs (such as my SERP API or OpenAI) to ensure the task are properly executed.
Unfortunately, now, it happens sometimes that I run into problems with PGBoss and the Postgres DB saying that there are too many connections.
At the moment, I create a PBBoss instance for each job/worker.
Could you tell me if:
1) I should rather create one PGBoss instance per user session instead to reduce the number of connections?
2) I should rather avoid using jobs/workers for smaller tasks (that still use an external API but might take less time than others).
Would love to get your feedback on best practices here! Thanks ❤️
19 replies
WWasp-lang
•Created by mb23 on 7/15/2024 in #🙋questions
How can I offer a free trial?
I'm using the OpenSaaS template and would like to offer a free trial. I can set up a free trial as part of a payment link but haven't found a way to link it to the code. Should I simply use the payment link JS code provided by Stripe and the replace the particular button in the app? 🙂
17 replies
WWasp-lang
•Created by mb23 on 7/11/2024 in #🙋questions
Updating and redeploying Postgres DB in Railway
Do I have to manually update/redeploy the Postgres database in Railway? I've reployed the app but the new Prisma schema is not reflected in the database.
On top of this, I'm also having this problem after redeployment again:
Access to XMLHttpRequest at 'https://server-production-....railway.app/auth/me' from origin 'https://...' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Maybe, it's somehow connected?
16 replies
WWasp-lang
•Created by mb23 on 7/8/2024 in #🙋questions
Issue with creating jobs/workers
I want to create jobs/workers for functions that use external APIs such as OpenAI so they're also processed if the user closes/refrehes the page.
Example:
For an outline creation function I have created:
1) a job definition in the main.wasp:
job createOutlineJob {
executor: PgBoss,
perform: {
fn: import { createOutlineWorker } from "@src/server/workers/outlineWorker"
},
entities: [User, Keyword, Headline, Websites]
}
2) an OutlineWorker,ts file in ..\app\src\server\workers that contains all helper functions for the main createOutlineWorker function and of course the createOutlineWorker function itself:
export const createOutlineWorker: CreateOutlineJob<Input, Output> = async ({ keywordId }, context) => {
3) reference on an app page:
import { createOutlineJob } from 'wasp/server/jobs';
...
const handleCreateOutline = async (keywordId) => {
try {
await createOutlineJob.submit({ keywordId: keywordId });
} catch (error) {
console.error('Failed to enqueue createOutlineJob:', error);
}
};
Still, I get this error and a blank page when i try to build:
ReferenceError: process is not defined
at config.ts:41:20
I've already read that this seems to be server code that's loaded in the client but having a hard time to figure out what to do about it :/
11 replies
WWasp-lang
•Created by mb23 on 7/5/2024 in #🙋questions
user.subscriptionStatus and user.subscriptionTier are not set
I've set up Stripe and can buy the test product using the right price ID.
User.StripeId and User.CheckoutSessionId are properly set in the database. I successfully get to /checkout?success=true afterwards. But user.subscriptionStatus and user.subscriptionTier are not set.
I've also checked the event data in Stripe, for example the checkout.session.completed is properly shown.
data[0]?.price?.id === process.env.PRO_SUBSCRIPTION_PRICE_ID is also true according to the Stripe event data.
(As used here in the StripeWebhook function:
if (line_items?.data[0]?.price?.id === process.env.PRO_SUBSCRIPTION_PRICE_ID) {
console.log('Pro subscription purchased');
await context.entities.User.updateMany({
where: {
stripeId: userStripeId,
},
data: {
hasPaid: true,
datePaid: new Date(),
subscriptionTier: TierIds.PRO,
},
});
} else {
response.status(404).send('Invalid product');
}
)
What can I do about it?
I've tried adding logs to the stripeWebhook function but they're not shown at all.
5 replies
WWasp-lang
•Created by mb23 on 7/2/2024 in #🙋questions
Where can I find the code for the login form?
Where can I find the code for the login form?
8 replies
WWasp-lang
•Created by mb23 on 7/2/2024 in #🙋questions
Change main font globally
I know it's probably a silly question but what's the easiest way to change the font-family globally? Through the tailwind.config.cjs?
9 replies
WWasp-lang
•Created by mb23 on 6/11/2024 in #🙋questions
Server is blocked by CORS policy
12 replies
WWasp-lang
•Created by mb23 on 6/10/2024 in #🙋questions
Affordable server solution
Hi there, I've built my first project using the OpenSaaS template and would like to deploy it.
I've read a bit about the cost of services such as Vercel and that they can explode if you're app gets a decent amount of traction.
What would be an affordable solution that costs less than $50 per month for the initial phase of a project and can be scaled on a budget? 🙂
Thanks in advance!
20 replies