Wasp-lang

W

Wasp-lang

Join the community to ask questions about Wasp-lang and get answers from other members.

Join

action calling action not working. Bad programming or issue?

Hi, i am using the latest wasp v12 version and started with a fresh saas template running on ubuntu Desktop 22. I tested the Fileupload page and it works. Now i started developing my own page and action. The page will trigger a action and the action downloads a (for now) hard-coded file that should be uploaded with the createFile action. Meaning 1 action calls a second action. (My backup action calls createFile action). The first part, getting the file works but the calling createFile fails. I copied the code from FileUploadPage.tsx into my backup.ts to trigger the upload. I changed the import in my backup.ts to: import { createFile } from 'wasp/server/operations'; ...
No description

useQuery in an eventHandler?

Is it possible to put useQuery in a click handler? Say I have a field that allows user to select a number, then I want to useQuery to fetch a custom query I wrote that queries the DB for a task with that number ID, whenever I do this I'm getting a react hooks issue about hooks can only be called in the body of a function component. My component is a function component, not sure what is going on but it seems to be related to the useQuery call as when I remove it the error goes away. I'd like to also use it to set state with reacts useState, but not sure how to manage that either....

Wasp start

Hi everyone, I am trying to use Wasp for the first time and although I was able to get all the dependencies and code, I can't seem to be able to run. This is that I get when I do from my mac. I'd appreciate any help MyApp % wasp start ...

Importing a json module

Hello again! One other minor issue I encountered: how can I import a JSON module (import { something } from "./somewhere/my.json";) ? I followed some TS tutorial and enabled esModuleInterop and resolveJsonModule compilerOptions in tsconfig.json but I get a build error in [ Wasp ] TS2732 cannot find module … consider using --resolveJsonModule...

Form Styling

I am having trouble finding the appropriate form template to style so that it looks more like my preferred colors. I tried using keywords, checking the whole client folder, exploring other folders, components, and form pages. All I am seeing is the SignupPage importing SignupForm but I cannot locate said form to change its styles. I tried altering FormLayout component to no avail. How do we change the forms?

ngrok...

Thought would be cool to share the app with a colleague using ngrok. Its breaking because auth/me on 3001 XMLHttpRequest cannot load http://localhost:3001/auth/me due to access control checks. ngrok http http://localhost:3000 ...

email template support

If I’m using mailgun as the mail provider, Is it possible to pass in an email template?

My login tab on the frontpage went missing after deployment on fly.io

:sadboi: I followed the step on the documentation and all, I put all the necessary secret keys like google client id, sendgrid API, REACT_APP_VARIABLE_KEYS. I went directly to /login, the front-end of google auth login is there, but it is not working. What else am I missing?...

WebSocket authentication

Hello this is maybe a stupid question, but looking at the websocket page in the docs I couldn't determine if there is a way (or maybe it already exists by default and it's just not mentioned) to restrict websocket connections to only authenticated users?

Template Signup Network Error

Hey, I cloned the open-saas template, connected external DB, migrated and seeded it successfully. When I start the server and try to signup (username and pass), I get a Network Error and some errors in the console that I can't figure out where they are coming from Please help :sadboi:
No description

Upload files using multer

I was following this gist to setup multer for uploading files but ran into errors, then realized it may be written for the version 0.11.8. I will continue to debug. Here are the errors: [ Client!] 9:13:35 PM [vite] Internal server error: Failed to resolve import "@wasp/api" from "../../../src/UploadPage.jsx". Does the file exist? ...

.wasp not recognising disambiguating relations

I have tried to define one-to-many relation between entities User and PurchaseRequest. Here is schema: `entity User {=psl /// purchaseRequestsCreated PurchaseRequest[] @relation(name: "createdBy")...

How to test delete function in open sass starter template

Hello I am new to wasp and im trying to figure out how to properly unit test the front end. I have an initial test that is passing, that tests the getAllTasksByUser query returns the tasks and renders to the front end. My failing test is supposed to follow a similar format as the first. Mock the function to return the expected data but im having trouble with a typescript error when passing in deleteTask to mockQuery -> "Argument of type 'Promise<GetResult<{ id: string; description: string; time: string; isDone: boolean; userId: number; createdAt: Date; }, unknown> & {}>' is not assignable to parameter of type 'Query<unknown, unknown>'. Type 'Promise<GetResult<{ id: string; description: string; time: string; isDone: boolean; userId: number; createdAt: Date; }, unknown> & {}>' provides no match for the signature '(queryCacheKey: string[], args: unknown): Promise<unknown>'.ts(2345)"...
No description

How to test the backend in isolation

how do you isolate and unit test the backend code, and also is there a way to view the payload of these backend opertaions without connecting to the client ( like maybe some kind of API so i can just check the json and interact with it via postman?!? )

Whenever I run `wasp db migrate-dev` on my ec2 instance (micro free tier) it causes the box to hang

the free tier only has like 1gb of memory so that could be the issue. is there anyone else whos run into this problem?

Is it possible to redirect post requests in wasp

Since there's no way to run code directly within Wasp upon signup or login, I've been trying to get around that while still keeping Wasp code untouched. I've created some custom code that I want to run on signup and I have it running on http://localhost:3002/auth/username/login. Wasp runs on port 3001 so usually the wasp request to that same endpoint would be at this link: http://localhost:3001/auth/username/login. When the post request is made to this link: http://localhost:3001/auth/username/login...

Importing external CSS

Hello, I’d like to use "flag-icons" package which one can import in normal React apps with: import "node_modules/flag-icons/css/flag-icons.min.css"; But I get errors with file not found when building with Wasp — if I try to import it with "../../…..", then it builds but there’s an error in the browser that the file can’t be accessed. What to do?...

Running database migrations on hosted app

Hey everyone! I have my app hosted on Fly. - When I try to sign up or log in, it says "Save failed: there was a database error" (see image 1). - The Fly monitoring logs state the issue quite clearly: "🐝 This error can happen if you did't run the database migrations" (see image 2). How do I go about running database migrations before I deploy a new release? I was looking at the Fly docs https://fly.io/docs/reference/configuration/#the-deploy-section, which say to add a release_command to the .toml file....
No description

Can Mage CLI review code?

Hey guys, I'm loving the WASP CLI so far. I'm wondering two things: 1. After I've generated code with WASP CLI AI and then added new code manually, is there a way to have the WASP AI re-review it and edit it? 2. This might be a dumb Q, but is it possible to use Open-SaaS template with the CLI AI? I'd love to use Open SaaS for frontend then have WASP AI create the actual app. But I feel like it could get messy...

Auth kicking out

This could be a normal behavior but feels weird. Please let me know if I can ignore. I can demo this app with Chrome and Safari so this won't happen in front of the stakeholders. I have 2 pages. Campaign page (get-campaigns) need auth. Upload page (get-campaign-by-token) does not need auth. Both pages are opened in Safari in different tabs. If I switch between tabs I am getting logged out. After writing this it sounds normal? Does it? Here is the log:...