Running into an issue with importing generated .wasp actions directory

I'm not sure why this happens, but seems like any time I modify the actions.js file or the function that invokes the action, I get this error on recompilation: [ Server!] node:internal/modules/esm/resolve:259 [ Server!] throw new ERR_UNSUPPORTED_DIR_IMPORT(path, fileURLToPath(base), String(resolved)); [ Server!] ^ [ Server!] [ Server!] Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import '/Users/gadicohen/2024/DreamProject/.wasp/out/sdk/wasp/dist/client/operations/actions' is not supported resolving ES modules imported from /Users/gadicohen/2024/DreamProject/.wasp/out/sdk/wasp/dist/client/operations/index.js [ Server!] at finalizeResolution (node:internal/modules/esm/resolve:259:11) .......... [ Server!] code: 'ERR_UNSUPPORTED_DIR_IMPORT', [ Server!] url: 'file:///Users/gadicohen/2024/DreamProject/.wasp/out/sdk/wasp/dist/client/operations/actions' [ Server!] } [ Server!] [ Server!] Node.js v20.15.1 [ Server ] [nodemon] app crashed - waiting for file changes before starting... code: // actions.js import { HttpError } from 'wasp/server' export const createStorybook = async ({ title }, context) => { if (!context.user) { throw new HttpError(401) }; const newStorybook = await context.entities.Storybook.create({ data: { title: title, userId: context.user.id } }); return newStorybook; } // apis.ts import { createStorybook } from 'wasp/client/operations'; ... const storybook = await createStorybook({ title: "My Storybook" }); --- I've tried wasp clean three times but am running into this issue every time.
6 Replies
kapa.ai
kapa.aiβ€’6mo ago
Hi @thereisnogadi. 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, it seems like you're having trouble with importing the createStorybook action from the generated .wasp actions directory. From the knowledge sources, it appears that some users have encountered similar issues when importing actions. The problem might be related to how you're importing the createStorybook operation. In the Discord support thread: import actions into main.wasp > Answers Part 4 (https://discord.com/channels/686873244791210014/1216119302244270181), a user had a similar issue and it was resolved by importing the action from wasp/client/operations instead of directly from its .js file. So, you might want to try changing your import statement to:
import { createStorybook } from 'wasp/client/operations';
import { createStorybook } from 'wasp/client/operations';
If the issue persists, it might be helpful to isolate the changes that made it stop working and provide those details for further investigation. Also, ensure that you're running a compatible version of Wasp. You can check your version by running wasp version. If you're running a version older than 0.12.X, you might need to migrate your project to the new structure (https://wasp-lang.dev/docs/migrate-from-0-11-to-0-12#migrating-your-project-to-the-new-structure). If none of these suggestions work, it would be best to reach out to the Wasp community or maintainers for further assistance. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @thereisnogadi, 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?
miho
mihoβ€’5mo ago
We are missing your Wasp file code, please share that as well πŸ™‚
thereisnogadi
thereisnogadiOPβ€’5mo ago
from main.wasp?
action createStorybook {
fn: import { createStorybook } from "@src/actions.js",
entities: [User, Storybook]
}
action createStorybook {
fn: import { createStorybook } from "@src/actions.js",
entities: [User, Storybook]
}
miho
mihoβ€’5mo ago
Hm, nothing seems wrong to me. Could you maybe share your entire project via git or as a zip file with me? πŸ˜„
thereisnogadi
thereisnogadiOPβ€’5mo ago
I can send you a zip of src via DM
miho
mihoβ€’5mo ago
Yeah, please do πŸ™ src + wasp file
Want results from more Discord servers?
Add your server