CamBlackwood
CamBlackwood
Explore posts from servers
WWasp-lang
Created by CamBlackwood on 10/24/2024 in #đŸ™‹questions
Expected Behaviour when running flyctl certs list -a <client app name>
@kapa.ai I'm fixing an issue where my site does not load at all when prefixing with www. It loads fine without it. I realised I was missing a CNAME record with www, so I've added one in my DNS settings, but when running flyctl certs list -a <client app name> I only get the domain without the www back. Is that expected? I have updated the DNS but it has only been a few minutes.
5 replies
WWasp-lang
Created by CamBlackwood on 10/17/2024 in #đŸ™‹questions
Best setup for cascading?
As part of my app, I have advanced stats for user profiles contained in a seperate table with a foriegn key relation. When deleting a user profile, I need to also delete the row in the advanced stats table (both for practical reasons, and because the process fails if I don't). What's the best way of doing that - I assume it's using onDelete in the schema file?
6 replies
WWasp-lang
Created by CamBlackwood on 10/12/2024 in #đŸ™‹questions
Job Hanging/Not Working when processing a large loop
I'm running a job on my database that current involves iterating over 800 elements and making an api call on each one, but it never gets past the first iteration, and nothing logs out. Is there anything it looks like I'm doing wrong? I've cut out some parts of the code to save on message length restrictions (mainly irrelevant variables)
export const updatePlatformStats = async (_args, context) => {
const unverifiedUsers = await context.entities.UnverifiedUser.findMany({
where: {
platformUsername: {
not: null,
},
},
});
for (let user of unverifiedUsers) {
const fullResponse = await fetch(
`https://api.someapi.com/v1/profile-videos?handle=${user.platformUsername}&amount=10
);

if (!fullResponse.ok) {
continue;
}

const videos = await fullResponse.json();
const formattedVideos = Array.from(videos).map((video: any) => {
return {
hashtags: video.challenges.map((challenge) => challenge.title),
stats: video.stats || null,
description: video.desc,
createdAt: video.createTime || null,
};
});
try {
const res = await context.entities.UnverifiedUserStats.upsert({
where: {
userId: user.id,
},
update: {
totalEngagementRate: parsedEngagementRate,
averageViews,
labelsUsed: [],
hashtagsUsed,
lastVideoDate,
},
create: {
totalEngagementRate: parsedEngagementRate,
averageViews,
labelsUsed: [],
hashtagsUsed,
lastVideoDate,
user: { connect: { id: user.id } },
},
});
} catch (error) {
console.error('Database upsert failed:', error);
}
}
};
export const updatePlatformStats = async (_args, context) => {
const unverifiedUsers = await context.entities.UnverifiedUser.findMany({
where: {
platformUsername: {
not: null,
},
},
});
for (let user of unverifiedUsers) {
const fullResponse = await fetch(
`https://api.someapi.com/v1/profile-videos?handle=${user.platformUsername}&amount=10
);

if (!fullResponse.ok) {
continue;
}

const videos = await fullResponse.json();
const formattedVideos = Array.from(videos).map((video: any) => {
return {
hashtags: video.challenges.map((challenge) => challenge.title),
stats: video.stats || null,
description: video.desc,
createdAt: video.createTime || null,
};
});
try {
const res = await context.entities.UnverifiedUserStats.upsert({
where: {
userId: user.id,
},
update: {
totalEngagementRate: parsedEngagementRate,
averageViews,
labelsUsed: [],
hashtagsUsed,
lastVideoDate,
},
create: {
totalEngagementRate: parsedEngagementRate,
averageViews,
labelsUsed: [],
hashtagsUsed,
lastVideoDate,
user: { connect: { id: user.id } },
},
});
} catch (error) {
console.error('Database upsert failed:', error);
}
}
};
24 replies
WWasp-lang
Created by CamBlackwood on 10/9/2024 in #đŸ™‹questions
Is it good practice to call an action in a job in wasp?
I have several processes in my app that normally run on cron jobs, but sometimes I want to click a button to run them manually via an admin dashboard (both for testing and for their actual functionality). Is it good practice to just create an action, and call it both from the front end and in a job?
20 replies
WWasp-lang
Created by CamBlackwood on 10/7/2024 in #đŸ™‹questions
Best way of adding a 404 page?
What's the optimum way of adding a 404 page to my wasp app - should I take the react router standard approach of a wildcard match as the last route listed?
7 replies
WWasp-lang
Created by CamBlackwood on 10/4/2024 in #đŸ™‹questions
Making sure www.<mysite>.com redirects to https://<mysite>.com?
@kapa.ai
This isn't really a wasp question as such (although it is a wasp app). I noticed my website only works with https:// in front and the www doesn't redirect after I deployed it on fly.io. What should I check to repair this?
6 replies
WWasp-lang
Created by CamBlackwood on 10/1/2024 in #đŸ™‹questions
Deploying Client Side Env Variables/Incorrect Useage?
I had client side env variables successfully running in production for a few days before they seemingly "turned off" (are undefined) - I didn't change anything (that I know of) This is how I use the variables
function isRunningLocally() {
return window.location.hostname === 'localhost';
}
if (!isRunningLocally()) {
// this isn't running
posthog.init(import.meta.env.REACT_APP_PUBLIC_POSTHOG_KEY!, {
api_host: import.meta.env.REACT_APP_PUBLIC_POSTHOG_HOST,
person_profiles: 'always',
});
}
function isRunningLocally() {
return window.location.hostname === 'localhost';
}
if (!isRunningLocally()) {
// this isn't running
posthog.init(import.meta.env.REACT_APP_PUBLIC_POSTHOG_KEY!, {
api_host: import.meta.env.REACT_APP_PUBLIC_POSTHOG_HOST,
person_profiles: 'always',
});
}
I set them via the REACT_APP_ANOTHER_VAR=somevalue wasp deploy fly deploy syntax as mentioned in the docs here - https://wasp-lang.dev/docs/advanced/deployment/cli#environment-variables-1 Is there anything I might have done wrong here?
21 replies
WWasp-lang
Created by CamBlackwood on 9/29/2024 in #đŸ™‹questions
Is there a way for me to run a SQL query on my local database?
I've had some issues with my local db due to a manual error, so I can't complete a migration. I know what the issue is (I need to delete some duplicate rows), but is it possible for me to run SQL on my local db?
8 replies
WWasp-lang
Created by CamBlackwood on 9/24/2024 in #đŸ™‹questions
Cron jobs running locally?
This is almost certainly a really stupid question, but I assume if the server is running locally, cron jobs will still fire and therefore update my database (when updating it in the job, of course)
13 replies
WWasp-lang
Created by CamBlackwood on 9/23/2024 in #đŸ™‹questions
Set up client environment variables and deployed, but not defined on prod?
I've integrated Posthog into my wasp application, but whilst it works locally with my environment variables, it does not work when deployed. As mentioned in the docs, I am using the correct syntax - eg. import.meta.env.REACT_APP_PUBLIC_POSTHOG_HOST, I have also made sure to deploy these new secrets to prod, and when requesting them via fly secrets list -a <app name>, they come back. However, when attempting to initalise posthog on prod, it throws an error saying the API key is undefined
14 replies
WWasp-lang
Created by CamBlackwood on 9/19/2024 in #đŸ™‹questions
What's the maximum payload entity size in wasp?
I'm getting PayloadTooLargeError: request entity too large errors if I pass JSON files into a create action. I've been experimenting a bit and it seems like it's around 100kb, is there any way to increase that? Or is it by design
6 replies
WWasp-lang
Created by CamBlackwood on 9/18/2024 in #đŸ™‹questions
After running a database migration locally, all my database deleted - how to prevent in prod?
I did a necessary migration where I converted a property of an entity to be unique. The migration all appeared to go smoothly, but after testing I realised it had actually deleted all the data locally, so the database is empty aside from the tables I already set up. I want to be able to do this in production, but maintain my existing data. What's the best way?
35 replies
WWasp-lang
Created by CamBlackwood on 9/16/2024 in #đŸ™‹questions
Stripe Webhook not firing when relevant events fire
I am trying to use the standard OpenSaaS implementation and have noticed that the stripe webhook does not fire at all even when the events are happening (I am testing it locally) - I've tried both just having it running and manually triggering the events and manually firing the events via the command line, but the stripe webhook doesn't run at all. I've added my STRIPE_WEBHOOK_SECRET to my env variables.
30 replies
WWasp-lang
Created by CamBlackwood on 9/16/2024 in #đŸ™‹questions
Deployed Server and Client appear "Disconnected"
I am deploying via the Wasp CLI with fly.io, and after trying to debug some unrelated deployment issues I now have a problem where it appears the client cannot connect to the database at all. The initial auth request is hanging and nothing involving the database works at all. I can see via listing the secrets that all the environment variables are correct (or at least present) on the server. Additionally, everything I try locally all works so I am unable to debug it locally. Looking at fly.io's dashboard, the server seems to be online and successfully receiving releases. I can also connect to it via the command line. Are there any steps I can take to figure out what's going on? I currently don't have a database backup so I'd like to avoid totally re-launching my app if possible.
24 replies
WWasp-lang
Created by CamBlackwood on 9/15/2024 in #đŸ™‹questions
Accidentally deleted database url from production environment while debugging - how to proceed
I have been debugging an issue and inadvertadly deleted my database url from my production environment whilst debugging a different issue. What's the best way of retireiving it?
84 replies
WWasp-lang
Created by CamBlackwood on 9/15/2024 in #đŸ™‹questions
Issue deploying with secrets
wasp deploy fly deploy cmd --context server secrets set $SECRETS This is giving me an error - error: unknown option '--context' The secrets are correct for sure - I am following this guide https://wasp-lang.dev/docs/advanced/deployment/cli
46 replies
WWasp-lang
Created by CamBlackwood on 9/13/2024 in #đŸ™‹questions
Is there a way to test run a job with a command in wasp?
I'd like to test a script that I wrote but as it only runs once a day it's not practical. I could try and use it in a different file but wanted to check if there was an easy way first
6 replies
WWasp-lang
Created by CamBlackwood on 9/3/2024 in #đŸ™‹questions
After deploying, my wasp app says "This site can’t be reached" - it was previously working
I had my wasp app working as expected after deploying to my domain last week, but now when I try and visit it (https://www.microinfluencer.club/), I get this error - www.microinfluencer.club’s server IP address could not be found. It was working last week, and I noticed the app says it is suspended on fly (but the client app is accessible on fly). The domain itself was previously configured to vercel, but as far as I know I removed everything related to that in my DNS settings.
18 replies
WWasp-lang
Created by CamBlackwood on 8/26/2024 in #đŸ™‹questions
Best Way of Migrating DB on deployed project?
When I'm running locally and my schema changes, I just run wasp db migrate-dev - what's the best approach for this when I have a production environment deployed?
20 replies
WWasp-lang
Created by CamBlackwood on 8/9/2024 in #đŸ™‹questions
Getting network errors when trying to authenticate when running app with remote database locally
I'm currently trying to test out some functionality locally that requires using the production database - I'm proxying requests to to a localhost port and can access the right data for sure (I can see it when I run wasp db studio) The specifc error I get is "ERR_CONNECTION_REFUSED"
15 replies