cmilazzo
WWasp
•Created by cmilazzo on 4/4/2025 in #đŸ™‹questions
call api from action
Can you call an api from an action?
11 replies
WWasp
•Created by cmilazzo on 4/4/2025 in #đŸ™‹questions
issue with entity id
I have a prisma entity defined as such:
"model SurveyResult {
id String @id
result String
reviews String @default("")
analysis String @default("")
idea Idea @relation(fields: [ideaId], references: [id])
ideaId Int
}"
I have an action that calls the entity create like this:
const surveyResult = await context.entities.SurveyResult.create({
data: {
result,
idea: { connect: { id: ideaId } }
},
id: reportId,
});
However, I'm getting the error "Unknown argument for 'id'. Available options are marked with ?."
Any suggestions?
8 replies
WWasp
•Created by cmilazzo on 4/4/2025 in #đŸ™‹questions
action chaining losing context
I have a action (Defined in my actions.js) that makes a call to an external async call via axios, and when the response is received needs to call another action to save the result to an entity. However, the second action seems to lose context (i.e. the user context is not passed along). What's the best pattern to do something like this?
5 replies
WWasp
•Created by cmilazzo on 3/27/2025 in #đŸ™‹questions
script in head
I have this section in my main.wasp file: "head: [
"<meta name="viewport" content="minimum-scale=1, initial-scale=1, width=device-width" />", "<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />", "<link rel="icon" href="/favicon.ico" type="image/x-icon" />", "<script src='https://js.stripe.com/v3/' />", "<script src='https://js.stripe.com/v3/pricing-table.js'></script>", "<stripe-pricing-table pricing-table-id='prctbl_1R6yHpQ3pz8nOT2l4854f2w1' publishable-key='pk_test_51Qrp2qQ3pz8nOT2laKRMYmvt5sRrXZjXNtDvNjDdgaX8BzFHon4z6thFxuR0ELGv5lZASVUdfEA5FyOcjqyfj1x500sau6o8yH'> </stripe-pricing-table>", ]" I am getting the following error: Parse error: Unexpected token: " Expected one of the following tokens instead: '(','[',']','{','import','true','false',<string>,<number>,<number>,'{=',<identifier> "<script src='https://js.stripe.com/v3/' />", "<script src='https://js.stripe.com/v3/pricing-table.js'></script>", What is the problem?
"<meta name="viewport" content="minimum-scale=1, initial-scale=1, width=device-width" />", "<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />", "<link rel="icon" href="/favicon.ico" type="image/x-icon" />", "<script src='https://js.stripe.com/v3/' />", "<script src='https://js.stripe.com/v3/pricing-table.js'></script>", "<stripe-pricing-table pricing-table-id='prctbl_1R6yHpQ3pz8nOT2l4854f2w1' publishable-key='pk_test_51Qrp2qQ3pz8nOT2laKRMYmvt5sRrXZjXNtDvNjDdgaX8BzFHon4z6thFxuR0ELGv5lZASVUdfEA5FyOcjqyfj1x500sau6o8yH'> </stripe-pricing-table>", ]" I am getting the following error: Parse error: Unexpected token: " Expected one of the following tokens instead: '(','[',']','{','import','true','false',<string>,<number>,<number>,'{=',<identifier> "<script src='https://js.stripe.com/v3/' />", "<script src='https://js.stripe.com/v3/pricing-table.js'></script>", What is the problem?
11 replies
WWasp
•Created by cmilazzo on 3/21/2025 in #đŸ™‹questions
Error: Blocked request. This host is not allowed.
To allow this host, add to
server.allowedHosts
in vite.config.js.10 replies
WWasp
•Created by cmilazzo on 2/14/2025 in #đŸ™‹questions
head
How do I add a script to the HEAD of an app?
4 replies
WWasp
•Created by cmilazzo on 12/4/2024 in #đŸ™‹questions
redirect after login
After logging in, I'd like to route to a profile page if the user has not yet finished profile setup. Otherwise, they should go to the dashboard page. How do I fork this routing?
11 replies
WWasp
•Created by cmilazzo on 11/18/2024 in #đŸ™‹questions
update wasp after usemage.ai creation
I have created an app use msemagi.ai. I have a lot of changes to customize the app, but need to update to version 0.15.0. who to do this?
18 replies
WWasp
•Created by cmilazzo on 11/17/2024 in #đŸ™‹questions
react-router-dom version
I'm getting an error when compiling: Error: Dependency conflict for user dependency (react-router-dom, ^6.28.0): Version must be set to the exactly the same version as the one wasp is using: ^5.3.3
I need features of the react-router-dom that were added after the version wasp is using. How do I update wasp to use a newer version of react-router-dom?
8 replies
WWasp
•Created by cmilazzo on 10/16/2024 in #đŸ™‹questions
add stripe
How do I add stripe support to an existing project created using Mage without Stripe?
5 replies
WWasp
•Created by cmilazzo on 10/16/2024 in #đŸ™‹questions
Google auth configFn and userSignupFields
When I add either of these functions to my main.wasp, I get errors.
My google auth method looks like this:
google: { configFn: import { getConfig } from "@src/pages/auth/google.jsx", userSignupFields: import { userSignupFields } from "@src/pages/auth/google.jsx" }, I have a google.jsx file created under src/pages/auth/google.jsx with the following: import { defineUserSignupFields } from 'wasp/server/auth' export const userSignupFields = defineUserSignupFields({ displayName: (data) => data.profile.name, address: (data) => { if (!data.address) { throw new Error('Address is required') } return data.address }, phone: (data) => data.phone, })
export function getConfig() { return { scopes: ['profile', 'email'], } }
google: { configFn: import { getConfig } from "@src/pages/auth/google.jsx", userSignupFields: import { userSignupFields } from "@src/pages/auth/google.jsx" }, I have a google.jsx file created under src/pages/auth/google.jsx with the following: import { defineUserSignupFields } from 'wasp/server/auth' export const userSignupFields = defineUserSignupFields({ displayName: (data) => data.profile.name, address: (data) => { if (!data.address) { throw new Error('Address is required') } return data.address }, phone: (data) => data.phone, })
export function getConfig() { return { scopes: ['profile', 'email'], } }
8 replies
WWasp
•Created by cmilazzo on 10/15/2024 in #đŸ™‹questions
google auth
I created an app using mage, and didn't include google authentication. I would now like to add that functionality. What is the simplest way to add that functionality?
31 replies
WWasp
•Created by cmilazzo on 10/11/2024 in #đŸ™‹questions
is it good practice to call an action from an api?
is it good practice to call an action from an api? If so, should it be done?
6 replies
WWasp
•Created by cmilazzo on 10/10/2024 in #đŸ™‹questions
delete entity
I have an entity called File which has an id. Give me an example action to delete a File
14 replies
WWasp
•Created by cmilazzo on 10/10/2024 in #đŸ™‹questions
Error handling in actions
How do you safely throw an exception from an action without crashing the server but make sure to notify the client?
4 replies
WWasp
•Created by cmilazzo on 10/10/2024 in #đŸ™‹questions
primitive type returns in action
Is there a way to return a string in an action? I've tried just adding it to the return statement, but typescript complains. I've also tried adding a returns: { file: File, key: string } statment to my action (I'm already returning a File entity as well). Is this even possible, or do I need to create a separate entity just to return the string?
13 replies
WWasp
•Created by cmilazzo on 10/5/2024 in #đŸ™‹questions
Meta tag in head
@kapa.ai How would I add a meta tag to the head of the document in the web-app?
5 replies
WWasp
•Created by cmilazzo on 10/4/2024 in #đŸ™‹questions
CORS issue on authentication
I have a server set up with the API running on port 448 (https). I'm getting this error:
Access to XMLHttpRequest at 'https://thehatchery.io:448/auth/me' from origin 'https://thehatchery.io' 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.
9 replies
WWasp
•Created by cmilazzo on 10/2/2024 in #đŸ™‹questions
wasp build
What command should I use to build the wasp application if I have REACT_APP_API_URL=https://thehatchery.io:448 and WASP_SERVER_URL=http://thehatchery.io:3001
14 replies
WWasp
•Created by cmilazzo on 10/1/2024 in #đŸ™‹questions
recommended ssl configuration for api server
@kapa.ai
I am installing a prduction Wasp server with nginx as a proxy server. I've configured port 80 and 443 on nginx to forward to port 3000 on the wasp server. However, authentication fails because the client REACT_APP_API_URL is set to port 3001. I believe I should change this to https (port 443) but doing so causes the following error: "useAuth.ts:23
GET https://thehatchery.io:3001/auth/me net::ERR_SSL_PROTOCOL_ERROR"
How should I be configuring the port forwarding and listening here, and what should my ENV variables be pointing to?1
43 replies