W
Waspβ€’4w ago
CamBlackwood

Job paths not resolving

I've been defining jobs the normal way (at least in wasp 0.14), and the compiler will not resolve the paths, even after manually rewriting them several times. job updateYTStats { executor: PgBoss, perform: { fn: import {updateStaleYouTubeStats} from "@src/server/workers/updateStaleYoutubeStats", }, schedule: { cron: "* * * * *" }, entities: [UnverifiedCreator, UnverifiedCreatorYouTubeStats] } the function exists at the root of the server/workers folder. Is there anything obvious I am missing @kapa.ai ?
4 Replies
kapa.ai
kapa.aiβ€’4w ago
Hi @CamBlackwood. 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 information provided in the knowledge sources, there are a few potential issues that could be causing the path resolution problem for your job definition. Let's go through them: 1. File extension: Make sure you include the file extension (.js or .ts) in your import statement. As mentioned in this GitHub issue (https://github.com/wasp-lang/wasp/issues/812), users need to add the file extension when importing jobs. Try modifying your import statement like this:
fn: import { updateStaleYouTubeStats } from "@src/server/workers/updateStaleYoutubeStats.js",
fn: import { updateStaleYouTubeStats } from "@src/server/workers/updateStaleYoutubeStats.js",
Or if you're using TypeScript:
fn: import { updateStaleYouTubeStats } from "@src/server/workers/updateStaleYoutubeStats.ts",
fn: import { updateStaleYouTubeStats } from "@src/server/workers/updateStaleYoutubeStats.ts",
2. Path rewriting: Wasp rewrites import paths that start with "@ext" or "@wasp" when generating the app. The IDE might not be aware of this rewriting, which could cause resolution issues. Make sure you're using the correct import path prefix. In your case, "@src" seems correct, but double-check that it's the expected prefix for your project structure. 3. Wasp compilation: Ensure that you've run the Wasp compiler to generate the necessary files. As suggested in this Discord thread (https://discord.com/channels/686873244791210014/1215750573278629958), try running wasp start to compile the SDK and generate all the wasp/* packages. 4. Clean and rebuild: If you're still experiencing issues, you can try cleaning your project and rebuilding it. As mentioned in the same Discord thread, you can use the following commands:
wasp clean
wasp start

wasp clean
wasp start

This will delete the .wasp folder and node_modules, then reinstall everything. 5. Check for typos: Ensure that the function name and file name in your import statement match exactly with the actual file and exported function name in your server/workers folder. If none of these solutions work, it's possible that there might be a bug in the current version of Wasp you're using. In that case, you may want to report the issue on the Wasp GitHub repository (https://github.com/wasp-lang/wasp) or seek further assistance from the Wasp community. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @CamBlackwood, 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?
Filip
Filipβ€’3w ago
Hello in this thread too πŸ˜„ Did this happen when you updated to 0.15.0 or? Also, which error message do you get?
CamBlackwood
CamBlackwoodOPβ€’3w ago
Hello πŸ‘‹ ! I can't remember the exact error message, was runing wasp 0.14 - but I solved it by including the file extension πŸ™‚
Filip
Filipβ€’3w ago
Ah man, sorry to hear that because this should work πŸ˜… That said, it's a known issue and we have it on the roadmap: - https://github.com/wasp-lang/wasp/issues/2224
GitHub
Implement proper import mappings in SDK generator Β· Issue #2224 Β· w...
After deciding which import strings we want to support in #2222, we should implement proper mappings for it in the SDK (and configure the LSP to allow or disallow them consistently). This is the cu...
Want results from more Discord servers?
Add your server