Hi, I am using wasp version 0.16.0 and the openSaaS tempalte on linux and I am experiencing some troubles using queries/actions on the server side. To reproduce: -create a new folder in src (let say /error. -make @src/error/queries.js file with this code;
-create another file; @src/error/queries2.js with this code:
import { getAllTasks } from "wasp/server/operations";// The 'args' object is something sent by the caller (most often from the client)export const getFilteredTasks = async (args) => { const { isDone } = args; // Fetch all tasks using getAllTasks const allTasks = await getAllTasks(); // Filter the tasks return allTasks.filter((task) => task.isDone === isDone);};
import { getAllTasks } from "wasp/server/operations";// The 'args' object is something sent by the caller (most often from the client)export const getFilteredTasks = async (args) => { const { isDone } = args; // Fetch all tasks using getAllTasks const allTasks = await getAllTasks(); // Filter the tasks return allTasks.filter((task) => task.isDone === isDone);};
Define the queries in the main.wasp file;
query getAllTasks { fn: import { getAllTasks } from "@src/error/queries.js"}query getFilteredTasks { fn: import { getFilteredTasks } from "@src/error/queries2.js"}
query getAllTasks { fn: import { getAllTasks } from "@src/error/queries.js"}query getFilteredTasks { fn: import { getFilteredTasks } from "@src/error/queries2.js"}
Now it throws an error:
[ Server!] code: 'ERR_MODULE_NOT_FOUND', [ Server!] url: 'file:///home/nuno120/Documents/BELLEN-AIPERSONAL/test2/app/.wasp/out/sdk/wasp/dist/ext-src/payment/plans' [ Server!] } [ Server!] Node.js v20.17.0 [ Server ] [nodemon] app crashed - waiting for file changes before starting...
When i change the import of the task in queries2.js to this: import { getAllTasks } from "wasp/ext-src/error/queries"; it works again btw! But not with the wasp/server/operations. Anyone knows why/how to fix? Also I don't understand why it throws an error in the payment/plants file and it get's fixed when I change the import in another file....
Recent Announcements
Continue the conversation
Join the Discord to ask follow-up questions and connect with the community
W
Wasp
Rails-like framework for React, Node.js and Prisma. Build your app in a day and deploy it with a single CLI command.