cannot find module ...payment/plans

[ Server!] Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/home/sven/SaaS/p/app/.wasp/out/sdk/wasp/dist/ext-src/payment/plans' imported from /home/sven/SaaS/p/app/.wasp/out/sdk/wasp/dist/ext-src/payment/operations.js [ Server!] at __node_internal_captureLargerStackTrace (node:internal/errors:496:5) [ Server!] at new NodeError (node:internal/errors:405:5) [ Server!] at finalizeResolution (node:internal/modules/esm/resolve:327:11) [ Server!] at moduleResolve (node:internal/modules/esm/resolve:946:10) [ Server!] at defaultResolve (node:internal/modules/esm/resolve:1132:11) [ Server!] at nextResolve (node:internal/modules/esm/loader:163:28) [ Server!] at ESMLoader.resolve (node:internal/modules/esm/loader:835:30) [ Server!] at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18) [ Server!] at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:77:40) [ Server!] at link (node:internal/modules/esm/module_job:76:36) { [ Server!] code: 'ERR_MODULE_NOT_FOUND' [ Server!] } [ Server!] [ Server!] Node.js v18.18.0 [ Server ] [nodemon] app crashed - waiting for file changes before starting...
9 Replies
kapa.ai
kapa.ai3d ago
Hi @Sven. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Based on the error message you provided, it seems like the Node.js server is unable to find the module '/home/sven/SaaS/p/app/.wasp/out/sdk/wasp/dist/ext-src/payment/plans'. This could be due to a few reasons: 1. The file does not exist: Make sure that the file 'plans' exists in the specified directory. 2. Incorrect file path: The path to the file might be incorrect. Double-check the path and make sure it's correct. 3. File is not exported: If the file exists and the path is correct, make sure that the file is being exported correctly. If you're still facing issues, you might want to try some of the solutions suggested in the knowledge sources: - Run wasp clean to delete all .wasp and node_modules stuff and then wasp start to reinstall everything again. This solution was suggested in a Discord support thread (https://discord.com/channels/686873244791210014/1215750573278629958). - Make sure that the Wasp version you're using is up-to-date. This was suggested in a Discord support thread (https://discord.com/channels/686873244791210014/1223793857246789703). - If Wasp is not installed in the PATH, you might want to add it. Instructions on how to do this should be provided during the installation process. This was suggested in a Github issue (https://github.com/wasp-lang/wasp/issues/112). If none of these solutions work, you might want to open a new issue in the Wasp Github repository (https://github.com/wasp-lang/wasp/issues) providing all the details of the problem. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Sven, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
Sven
Sven3d ago
Fixed i guess, now i have this:
`getLastUserSalesData` is not exported from @src/actions/queriests
`getLastUserSalesData` is not exported from @src/actions/queriests
here: query getLastUserSalesData { fn: import { getLastUserSalesData } from "@src/actions/queries", entities: [UserSalesData] } eventhough in queries.ts
import { Products,UserSalesData } from 'wasp/entities'
import { type GetProducts } from 'wasp/server/operations'
import { type GetLastUserSalesData } from 'wasp/server/operations'

import { type GetProductStats } from 'wasp/server/operations'

export const getLastUserSalesData: GetLastUserSalesData<void, any> = async (args, context) => {
return context.entities.UserSalesData.findMany({
orderBy: { date: 'desc' },
take: 30
})
}

import { Products,UserSalesData } from 'wasp/entities'
import { type GetProducts } from 'wasp/server/operations'
import { type GetLastUserSalesData } from 'wasp/server/operations'

import { type GetProductStats } from 'wasp/server/operations'

export const getLastUserSalesData: GetLastUserSalesData<void, any> = async (args, context) => {
return context.entities.UserSalesData.findMany({
orderBy: { date: 'desc' },
take: 30
})
}

@kapa.ai
kapa.ai
kapa.ai3d ago
Let me check the knowledge base for you. One moment! :books: ---------------------- Based on the error message and the code you provided, it seems like the issue might be related to the import path in your Wasp query declaration. In your query declaration, you're trying to import getLastUserSalesData from "@src/actions/queries", but based on your queries.ts file, it seems like getLastUserSalesData is actually located in queries.ts, not in an actions directory. Try updating your query declaration to import from "@src/queries" instead:
query getLastUserSalesData {
fn: import { getLastUserSalesData } from "@src/queries",
entities: [UserSalesData]
}
query getLastUserSalesData {
fn: import { getLastUserSalesData } from "@src/queries",
entities: [UserSalesData]
}
This should correctly point to the getLastUserSalesData function in your queries.ts file. Remember, the fn: import { function } from "path" syntax in Wasp query and action declarations is used to specify where the implementation for the function is. The path should resolve to the .js or .ts file where the function is exported. You don't need to specify an extension in the path (source (https://wasp-lang.dev/docs/tutorial/queries)). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Sven, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
Sven
Sven3d ago
@kapa.ai the queries.ts is located in the actions dir
kapa.ai
kapa.ai3d ago
Let me check the knowledge base for you. One moment! :books: ---------------------- If your queries.ts file is located in the actions directory, then your original import statement is correct. However, the error message suggests that getLastUserSalesData is not being exported from @src/actions/queries. Looking at your queries.ts file, it seems like you are exporting getLastUserSalesData correctly. Here are a few things you could check: 1. File saved: Make sure you have saved the queries.ts file after adding the getLastUserSalesData function. 2. Correct directory: Ensure that the queries.ts file is indeed in the actions directory. 3. Correct Wasp project structure: All your source files should be in the src directory as per the Wasp project structure (https://wasp-lang.dev/docs/migrate-from-0-11-to-0-12#next-steps). 4. Correct import path: The import path should be relative to the src directory. So if your queries.ts file is in src/actions/queries.ts, the import path should be "@src/actions/queries". 5. Correct Wasp and Node.js versions: Make sure you are using a version of Wasp and Node.js that supports the features you are using. You can check the required versions in the Wasp documentation (https://wasp-lang.dev/docs). If you've checked all of these and the problem persists, there might be an issue with your Wasp installation or project setup. In that case, consider seeking help from the Wasp community or the Wasp team directly. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Sven, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
Sven
Sven3d ago
@kapa.ai any way of restarting my wasp
kapa.ai
kapa.ai3d ago
Let me check the knowledge base for you. One moment! :books: ---------------------- Yes, you can restart your Wasp application by stopping the current running instance and then starting it again. Here's how you can do it: 1. Stop the current running instance: You can do this by pressing Ctrl + C in the terminal where your Wasp app is running. 2. Start the Wasp app again: You can do this by running the wasp start command in your terminal. If you're facing issues and want to start fresh, you can also use the wasp clean command before starting your app again. This command deletes all generated code, all cached artifacts, and the node_modules directory. It's the Wasp equivalent of 'have you tried closing and opening it again?'. Here's how you can use it:
wasp clean
wasp start
wasp clean
wasp start
You can find more information about these commands in the Wasp CLI Reference (https://wasp-lang.dev/docs/general/cli#overview). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Sven, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
Sven
Sven3d ago
@kapa.ai when someone goes on my page and on this page i run an action defined in main.wasp what happens when before the request is finished sucesfully the person leaves the page. will the request be aborted an not go on on server side?
kapa.ai
kapa.ai3d ago
Let me check the knowledge base for you. One moment! :books: ---------------------- When a user navigates away from a page, any ongoing HTTP requests initiated by that page are typically cancelled by the browser. However, whether or not the server stops processing the request depends on how the server is implemented. In the context of Wasp and its underlying technologies (React, Node.js), if a request is initiated from the client side (for example, by calling an action), and the user navigates away from the page before the request is completed, the browser cancels the HTTP request. However, the server might continue processing the request, especially if it has already received it. It's important to note that even if the server completes the processing of the request, the response will have no effect on the client side because the client (browser) has already cancelled the request. In summary, while the client-side effect of the request is cancelled when a user navigates away from the page, the server may still carry out its processing depending on the specifics of the implementation. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Sven, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
Want results from more Discord servers?
Add your server