neogeofun
neogeofun
WWasp-lang
Created by neogeofun on 8/30/2024 in #đŸ™‹questions
Updating to Prisma v5
Half question, half suggestion. Prisma v5 has performance improvements, but more important transactions & createManyAndReturn are available. I feel transactions are very important because they allow easy way to rollback. If I am updating multiple tables for a single operation and if anything fails in this process, now I have to find all previous updates and make sure they are rolled back. I am not aware if there is an API way of doing this without transactions in prisma. Let me know your thoughts. Thanks. PS: I did try to update to v5, however, v4.16 comes from another dependency or from the internal engine I think, so I couldn't change it by just updating package.json.
7 replies
WWasp-lang
Created by neogeofun on 8/30/2024 in #đŸ™‹questions
Error Report from Stripe.ts and Relevant Questions
Posting enough to show error for privacy reasons:
Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client.

at stripeWebhook (/path/app/src/server/webhooks/stripe.ts:253:26)
[ Server!] at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[ Server!] at <anonymous> (/path/app/.wasp/out/sdk/wasp/server/utils.ts:26:5)
Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client.

at stripeWebhook (/path/app/src/server/webhooks/stripe.ts:253:26)
[ Server!] at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[ Server!] at <anonymous> (/path/app/.wasp/out/sdk/wasp/server/utils.ts:26:5)
And this is line 253 from Stripe.ts:
response.status(400).send(`Webhook Error: ${err?.message}`);
response.status(400).send(`Webhook Error: ${err?.message}`);
When I log the error right before (it is inside a catch block), it is the same as 'Cannot set headers after they are sent to the client.' Couple other notes, I did some changes to webhook but I am not sending any extra responses, just capturing extra events to do some updates and record customer payments:
else if (event.type === 'charge.succeeded')
else if (event.type === 'charge.succeeded')
The work goes through successfully (payment is recorded in the db) and nothing is functionally affected by this error but figure this should still be considered.
9 replies
WWasp-lang
Created by neogeofun on 8/23/2024 in #đŸ™‹questions
Worth Moving to the Current State of Open SaaS?
My project is nearing its end. I started about mid June. What do authors think? Are the changes going to add significant value / security / ease of use etc.? Effort would be migrating client, actions, main.wasp (already manually migrated to wasp 0.14), schema, package.json etc. basically I'd think it'd be mostly copy and paste. Opinions?
7 replies
WWasp-lang
Created by neogeofun on 7/30/2024 in #đŸ™‹questions
React Query questions
How are the cache keys handled under hood? Let's say I visited a page where user has a list of favorite items. Then the user visits an item's page. On this page, I could access the cache and if the item is in the list save an API call. But I couldn't access the query cache key. So I checked React Dev Tools, went to QueryClientProvider on components and checked client. QueryCache element is there; so clicked on it and found that it only contains the most recent page's queries cached. If I am on favorites page it will be something like: 1. ["auth/me"] 2. ["favorites-endpoint-url"] And if I go another page, "favorites-endpoint-url" won't be in the cache keys anymore. Instead Is there a bug? Or is there something that I should be doing other than providing the query function and data to useQuery (I thought cache key creation was handled by Wasp)? Or am I just looking at the wrong place?
23 replies
WWasp-lang
Created by neogeofun on 7/25/2024 in #đŸ™‹questions
React Query Defaults
What are the default settings in Wasp for React Query? For example, what is the cache item lifetime. Do I need to create cache keys or is it handled internally? Or is everything just React Query defaults and will reading React Query docs is sufficient? Thanks.
6 replies
WWasp-lang
Created by neogeofun on 7/20/2024 in #đŸ™‹questions
Migration to 14, should update auth field?
I am using OpenSaas. Right now I am working on migration to v0.14. I followed the guide on the docs, but now userEntity: User causes a type error on main.wasp (undefined identifier, because the entity is no longer on .wasp file I think). Besides Wasp v.0.14, I see changes to the OpenSaas code, such as @src/auth/email-and-pass folder and its code (which requires changes to the main.wasp), there are probably more changes. To get the most up-to-date code for my project, do I need to do anything other than copy and paste the new stuff (or is there an automatic update)?
17 replies
WWasp-lang
Created by neogeofun on 7/4/2024 in #đŸ™‹questions
Prisma Error Handling
I have a combination ID on a table to enforce uniqueness of entity relations. I would like to send the user a message based on the error returned by Prisma. Normally, Prisma library provides errors to handle this: https://www.prisma.io/docs/orm/prisma-client/debugging-and-troubleshooting/handling-exceptions-and-errors However, I am unable to import these Prisma errors to my server code. Is there a way to do this? Thanks.
7 replies
WWasp-lang
Created by neogeofun on 7/1/2024 in #đŸ™‹questions
What would you recommend for autocomplete search? Cache?
Without going into too much detail, how would we integrate something like Redis or elastic search for these purposes? Custom API endpoints? Create separate services and call from WASP custom endpoints? Ideas.
7 replies
WWasp-lang
Created by neogeofun on 6/30/2024 in #đŸ™‹questions
How to do relationship updates? Prisma fails when doing connection to relationship.
One entity has relationship to another entity (table relationship). Per prisma docs I should be able to update it like this from .update method: data: { status: status, city: { connect: { id: cityId } } So city is the relationship, cityId is a column in user as a FK. I tried other variations such as setting cityId: cityId directly. It won't work. Auto generated and compiled types are a mess and I think that is the reason.
18 replies
WWasp-lang
Created by neogeofun on 6/30/2024 in #đŸ™‹questions
The application isn't picking up server changes (on Actions.ts).
I make changes and send request from the front end, but it is stuck at older version of file. It shows an error, but reported error is based on the old version of the file. Changes to actions.ts file isn't being picked up.
15 replies