hi getting a [ Server ] POST /operations/stripe-payment 500 44.007 ms .

How to run wasp with more debug messages, also analyzing errors ?. like adding debug.log etc
51 Replies
miho
mihoβ€’8mo ago
What do you see in the terminal? πŸ™‚
ramkumar9226
ramkumar9226β€’8mo ago
well nothing much
MEE6
MEE6β€’8mo ago
Wohooo @ramkumar9226, you just became a Waspeteer level 1!
ramkumar9226
ramkumar9226β€’8mo ago
that is why i wanted to see if there is a way to debug this
matijash
matijashβ€’8mo ago
you should be getting full error messages, everything that comes from React & Node is forwarded!
miho
mihoβ€’8mo ago
500 tells us something is off πŸ˜„ for this you should get some logs
noamico
noamicoβ€’8mo ago
same here. im getting a tax error issue which is werid i have this stripe acct working on other apps and never seen this
noamico
noamicoβ€’8mo ago
"message": "Stripe Tax has not been activated on your account. Please visit https://stripe.com/docs/tax/set-up to get started."
Set up Stripe Tax
Enable Stripe Tax to automatically calculate and collect tax.
miho
mihoβ€’8mo ago
@Vinny (@Wasp) please take a look at this one πŸ€·β€β™‚οΈ
Vinny (@Wasp)
Vinny (@Wasp)β€’8mo ago
do you have the stripe webhook forward to port 3001? >> https://docs.opensaas.sh/guides/stripe-testing/
OpenSaaS.sh
Stripe Testing
Open SaaS is a free, open-source, full-stack SaaS starter kit for React + NodeJS.
Vinny (@Wasp)
Vinny (@Wasp)β€’8mo ago
maybe check your API version numbers. what version/date are you running in your other apps?
Vinny (@Wasp)
Vinny (@Wasp)β€’8mo ago
Another user had the same issue and they were able to fix it by going to their tax dashboard:
"...i fixed the tax stuff on stripe dashboard: https://dashboard.stripe.com/tax/setup"
Stripe Login | Sign in to the Stripe Dashboard
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
noamico
noamicoβ€’8mo ago
no i was able to fix it. u have the stripe tax flag in code set to true. u should set it to false cause not all accts have it enabled and it prevents the stripe integraton from working πŸ™‚ @Vinny (@Wasp) can u tell me how we can connect this to a flask backend ? and how can we build on top of the existing app ? its nice to get the initial login/stripe/HP but what if we want to add custom pages that fetch some data from a flask app or a python websocet ? how do we build on top of this app ?
Vinny (@Wasp)
Vinny (@Wasp)β€’8mo ago
just call those endpoints in your frontend code
set it to false cause not all accts have it enabled and it prevents the stripe integraton from working
cool thanks for the tip πŸ™‚
noamico
noamicoβ€’8mo ago
can u elaborate more pls ?to add new /custom pages we should just create react components in client dir ?
Vinny (@Wasp)
Vinny (@Wasp)β€’8mo ago
to create new pages and client routes check out these docs here > https://wasp-lang.dev/docs/tutorial/pages
3. Pages & Routes | Wasp
In the default main.wasp file created by wasp new, there is a page and a route declaration:
noamico
noamicoβ€’8mo ago
will do tnx ! also @Vinny (@Wasp) sry for bombaring u with multiple Q's haha but the admin panel doesnt work for some reason. we get this :
No description
MEE6
MEE6β€’8mo ago
Wohooo @noamico, you just became a Waspeteer level 1!
noamico
noamicoβ€’8mo ago
event though we have 5 registred users, and stripe revenue
Vinny (@Wasp)
Vinny (@Wasp)β€’8mo ago
the cron job runs every hour so maybe that;s why
noamico
noamicoβ€’8mo ago
this has been up fpr 24 hrs already why does it need cron to do this ? cant it just query stripe/PG when needed ?
Vinny (@Wasp)
Vinny (@Wasp)β€’8mo ago
you can move it to a query if you prefer, but I did it like that becasue it's pulling from multiple APIs and doing a lot of background work
noamico
noamicoβ€’8mo ago
how do i debug this to make it work how do i make sure the cron is running ? cause the Daily stats tbl is empty
Vinny (@Wasp)
Vinny (@Wasp)β€’8mo ago
I would change the cron schedule in the main.wasp to run every minute and check that it’s pulling stats and saving to your db. It starts automatically when you run wasp start
noamico
noamicoβ€’8mo ago
tbl is empty so something not working there ... ok i think i know the issue u guys should rly go over the defualy settings u have set for the project. my hunch is if we dont have plausible analystics set the script fails
Vinny (@Wasp)
Vinny (@Wasp)β€’8mo ago
yes this is could be why you need to use either plausible or google
Vinny (@Wasp)
Vinny (@Wasp)β€’8mo ago
GitHub
open-saas/app/src/server/workers/calculateDailyStats.ts at main Β· w...
A free, open-source SaaS app starter for React & Node.js with superpowers. Production-ready. Community-driven. - wasp-lang/open-saas
Vinny (@Wasp)
Vinny (@Wasp)β€’8mo ago
check your Logs, too. If the calculateDailyStats job fails, it will save a log to the DB
noamico
noamicoβ€’8mo ago
i added plausible
MEE6
MEE6β€’8mo ago
Wohooo @noamico, you just became a Waspeteer level 2!
noamico
noamicoβ€’8mo ago
but not working
Vinny (@Wasp)
Vinny (@Wasp)β€’8mo ago
did you look at the Logs in your DB? first try that. next would be debugging the calculateDailyStats function to do that, I would change the job to run every minute in the main.wasp file
martinsos
martinsosβ€’8mo ago
Or, call them from the server code! Whatever makes more sense.
Vinny (@Wasp)
Vinny (@Wasp)β€’8mo ago
Yes, that's true! Btw, let me know how things go once you've done some more debugging @noamico -- I'm keen to get your problem resolved, so let me know what happens or if you get stuck / have any more questions πŸ™‚
noamico
noamicoβ€’8mo ago
[ Server ] POST /operations/get-daily-stats 500 5.622 ms - 724 [ Server!] NotFoundError: No DailyStats found [ Server!] at /Users/noamico/dev/wasp-demo/app/node_modules/@prisma/client/runtime/library.js:162:12389 [ Server!] at async /Users/noamico/dev/wasp-demo/app/node_modules/@prisma/client/runtime/library.js:162:12328 [ Server!] at getDailyStats$2 (/Users/noamico/dev/wasp-demo/app/src/server/queries.ts:78:22) [ Server!] at <anonymous> (/Users/noamico/dev/wasp-demo/app/.wasp/out/server/src/middleware/operations.ts:13:24) [ Server!] at <anonymous> (/Users/noamico/dev/wasp-demo/app/.wasp/out/sdk/wasp/server/utils.ts:31:5) [ Server!] Error calculating daily stats: Error: HTTP error! Status: 404 [ Server!] at getTotalPageViews (/Users/noamico/dev/wasp-demo/app/src/server/workers/plausibleAnalyticsUtils.ts:46:11) [ Server!] at process.processTicksAndRejections (node:internal/process/task_queues:95:5) [ Server!] at getDailyPageViews (/Users/noamico/dev/wasp-demo/app/src/server/workers/plausibleAnalyticsUtils.ts:28:22) [ Server!] at calculateDailyStats (/Users/noamico/dev/wasp-demo/app/src/server/workers/calculateDailyStats.ts:44:55) [ Server!] at async resolveWithinSeconds (/Users/noamico/dev/wasp-demo/app/node_modules/pg-boss/src/manager.js:34:14) [ Server!] at async /Users/noamico/dev/wasp-demo/app/node_modules/p-map/index.js:57:22 can u give some more info on how to utilize a flaks backend which has a websocket ? @martinsos
martinsos
martinsosβ€’8mo ago
So there are two main ways to utilize that flask backend, either from the client code (React) or server code (NodeJS). Websocket or not, this wouldn't really be Wasp specific -> but React / NodeJS specific. For example, if your Flask server has HTTP routes, you can access though using axios from your React or Node code. So again, nothing Wasp specific here really. Websockets -> well again, similar thing, you would not be using axios though, but another library which is a better fit for websockets -> maybe https://socket.io . Wasp does have some support for the websockets out of the box (https://wasp-lang.dev/docs/advanced/web-sockets), but this is to help you with connecting Wasp client and server code. If you want to use websockets with your Flask project, then you should set that up on your own, and it should be quite doable. Now, what I can't know, is if you want to connect from Wasp client directly to the Flask backend via websocket(s), or you want to connect from Wasp client to Wasp server via websockets and then from there to Flask backend via websockets also. Depends if the data from Flask backend is public or not. If it is private, and you want to first authenticate user and check if they have access, then I would advise going Wasp client -> Wasp server (does the auth and stuff) -> Flask server (produces data). On Flask server side, you could have a secret that only Wasp server knows and uses to connect to Flask server, so nobody else can access it. And Wasp server does the auth and so on, so it can decide what it forwards from Flask server to the Wasp client. Btw, that Flask server, you will need to get that running on your own, it is a standalone service / microservice. I hope this helps, the thing this is quite custom so I can't so easily offer more information without knowing more, but you can always ask us for more help as you go along. Btw, would you be able to share a bit more about what you are building? Do you already have an existing Flask code? How do you imagine complete architecture of the app -> Wasp app as the main piece of the code, and some Flask code in the background doing somethign specific? Why Flask code, why not write it direclty in Wasp via Node? Because you need some Python libraries? Anything you can share helps! @noamico what exactly would you suggest we modify regarding the default settings?
noamico
noamicoβ€’8mo ago
@martinsos u are so helpful, i rly apprec the time u took to write that all !!
noamico
noamicoβ€’8mo ago
1) stripe tax flag > set to false otherwise will crash integration
No description
noamico
noamicoβ€’8mo ago
2) plausible/google analytics stuff -- the defualt behavior should be consistent imo and not assume a user has any of them. bcs if he uses GA - he nedds to go ahead and start commenting stuff in by himself 3) maybe consider making email auth as default. i had there (and others as well from what ive read) and most will use email auth bcs u need a user email today almost in any app
noamico
noamicoβ€’8mo ago
still cant get plausible to work, here are logs :
No description
noamico
noamicoβ€’8mo ago
any idea ?
martinsos
martinsosβ€’8mo ago
This all sounds reasonable to me, but @Vinny (@Wasp) is our OpenSaas expert and knows much more than me about it so will be able to provide more insights! That said, @Vinny (@Wasp) is in a bit of a pinch preparing for the talk on the Node summit conference :D, so would be ideal if you could open Github issues for some of these on open-saas GH repo and we can then continue handling it there, so it doesn't get lost. 1) Would be great if you can create a GH issue! 2) plausible/google -> also, GH issue would be perfect! 3) I completely agree, we actually discussed this today on the team meeting and will be doing it quite soon -> here is an issue talking about it: https://github.com/wasp-lang/wasp/issues/1848 .
GitHub
Make email auth a default auth method Β· Issue #1848 Β· wasp-lang/wasp
Username&Pass (U&P) as an auth method is great due to minimal requirements it has, but it is not a production-level solution. Since we use it as a default method in our tutorials/examples/s...
Vinny (@Wasp)
Vinny (@Wasp)β€’8mo ago
I created an issue for the stripe flag already this morning but the others not. It would be a big help if you could add them to the open SaaS repo @noamico thanks πŸ™
noamico
noamicoβ€’8mo ago
i will ok can u help w plausible issues ?
Vinny (@Wasp)
Vinny (@Wasp)β€’8mo ago
Not at the moment unfortunately. But from what I can see the getTotalPageViews is throwing a 404 not found error. I’d start looking into why that’s happening. You can always provide some more info here and perhaps someone from the team can help more tomorrow
martinsos
martinsosβ€’8mo ago
I don't know unfortunately hm. 404 so not found -> sounds like Pplausible is trying to get something form somewhere but it doesn't exist. Did you add PLAUSIBLE_SITE_ID? Is it corectly set, so Plausible can go reach it? If it is very fresh, your domain, maybe it will take a while till DNS servers that Plausible is hitting propagate?
noamico
noamicoβ€’8mo ago
ahhh finally god damn it found the issue u have a bug in the url : it has v1 twice i dont understand how no one else found this haha.. i though many ppl used this before me
noamico
noamicoβ€’8mo ago
No description
No description
Vinny (@Wasp)
Vinny (@Wasp)β€’8mo ago
Oh thanks for reporting this! Glad it’s working now
martinsos
martinsosβ€’8mo ago
Uff! Sorry for this and great job on figuring it out. Maybe they didn't use plausible, or they fixed it without reporting -> for every person that comes to Discord, there are a couple that are most likely silent. @noamico could you please open an issue for this one and we will prioritize it? You could even go for a PR if you want/can!
martinsos
martinsosβ€’8mo ago
Ok I just realized @Vinny (@Wasp) alrady creatd a GH issue, here it is: https://github.com/wasp-lang/open-saas/issues/79
Want results from more Discord servers?
Add your server