Broken generator
I'm attempting to configure a third-party generator in my instance. On the first attempt, setting
provider = prisma-docs-generator
produces the following compilation error:
Then a bit more digging online led me to try changing it to provide = node node_modules/prisma-docs-generator
, but that failed with the following error:
What is the correct way to include additional generators?10 Replies
Hi @genyus. 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 knowledge sources provided, I don't have specific information about configuring third-party generators in Wasp or the correct way to include additional generators. The documents mainly discuss Prisma-related issues and Wasp's internal structure, but they don't directly address your question about adding custom generators.
However, I can provide some general insights based on the errors you're encountering:
1. The first error suggests that the
prisma-docs-generator
is not installed or not in your PATH. This is typically resolved by installing the generator package.
2. The second error indicates that Wasp is looking for the generator in a specific location within its generated structure (web/app/.wasp/out/server/node_modules/prisma-docs-generator
), but it's not finding it there.
Given Wasp's unique structure and how it manages dependencies, the standard approach for adding Prisma generators might not work directly. Wasp seems to have its own way of handling Prisma and its related packages.
To get a definitive answer on how to correctly include additional generators in Wasp, I would recommend:
1. Checking the official Wasp documentation for any information on custom Prisma generators.
2. If not found in the docs, reaching out to the Wasp community or maintainers directly through their GitHub issues or Discord channel for guidance.
I apologize that I couldn't provide a more concrete solution based on the available knowledge sources. The correct approach might require specific knowledge about Wasp's internal workings and its integration with Prisma, which isn't covered in the provided documents.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @genyus, 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?Ok, I understand the problem now, but I’m not sure how to resolve it.
I realise that the first configuration fails because the generator isn’t on the path, and it’s being run as a command. The second configuration fails because the server is looking inside its local node_modules directory (which I assume must be generated by Wasp), not the node_modules directory in the project.
Having the definition present in schema.prisma breaks compilation, but I can run it manually using
npx prisma generate
. How can I install/configure it so that the generator is visible to the server?
Can anyone from @Wasp Team point me in the right direction?Wohooo @genyus, you just became a Waspeteer level 1!
I think you correctly identified what happens -> prisma-docs-generator gets installed in top level node_modules, not in the one in .wasp/out/server, and prisma commands run in the context of ./wasp/out/server, so it doesn't find it there.
What if you did
provider = "npx prisma-docs-generator"
, would that work?
Alternatively, you could also try provider = "node ../../../node_modules/prisma-docs-generator"
, although npx
sounds better since it will do this work of climbing up and finding a package for you.
@Filip you might find this interesting.Thanks for following up and apologies for the late response. Just to close this off — I ended up finding another approach to resolve my issue which meant I didn't need to use the actual generator I was trying to incorporate. However, unless I've missed some mechanism to modify the server package configuration, my experimenting appears to suggest that many Prisma generators won't be compatible with Wasp, which is a shame.
Yeah, sounds right. We tried to move it into the project dir for 0.12.0 (restructuring), but then had to revert it because of env vars.
I created a new issue to track this: https://github.com/wasp-lang/wasp/issues/2404
That's good to know, thanks for the update
@genyus thanks for letting us know! Did you however try using
npx prisma-docs-generator
, did that work?So for this particular generator,
npx prisma-docs-generator
doesn't work as it executes a different action to running node against the package directory. It does, however, work using the full path as you provided:
@genyus ok thanks for letting us know!