"Hidden" schema error (?) causing cascading import failures

I had a feature branch working, with large numbers of code and schema changes. I switched branches, causing consternation in prisma & generated a migration and blew away the database in order to run. I did some other work in master, now I've switched back to the feature branch and made (another) migration for the same thing... Now I am getting a seemingly endless series of errors on code which isn't changed by this branch, all of the form "import foo from '../somewhere/somthing". It seems if I modify the import path in some way, like, say if it was "../server/foo" but we are already in the server directory, I can change it to "./foo" - which is technically the same directory, then we get past that error. Then another seemingly random import from another file (which used to work), is now failing, it seems the compilation stops on the first broken import & many are broken. I can sweep through many files which should not need to be changed, and seemingly never clear this. Wasp clean / wasp build does not change the outcome. I believe this is related to a schema change, because had this same scenario ≈ two weeks ago and had to hand-merge-file-by-file until I -finally- got an error message related to schema which I fixed - and this problem went away. I forget what that issue was, but this is the same symptom. What could be the issue @kapa.ai ?
4 Replies
kapa.ai
kapa.ai2w ago
Hi @Conspyre. 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 experiencing a series of import errors in your Wasp project after switching branches and making schema changes. This could be due to a number of reasons, but as you've suggested, it might be related to changes in your Prisma schema. One possibility is that the Prisma client hasn't been properly initialized after your schema changes. As mentioned in this Github issue (https://github.com/wasp-lang/wasp/issues/427), you might encounter an error if the Prisma client isn't initialized correctly. The error message suggests running prisma generate to initialize the client. If the Prisma client isn't properly initialized, it could potentially lead to issues with your imports. Another possibility is that there are issues with your Prisma schema itself. As discussed in this Github issue (https://github.com/wasp-lang/wasp/issues/805), Wasp might not properly recognize or compile certain fields in your Prisma entities depending on their placement within the entity object. This could potentially lead to unexpected behavior in your Wasp app. To troubleshoot this issue, you might want to: 1. Run prisma generate to ensure that the Prisma client is properly initialized. 2. Check your Prisma schema for any potential issues. Make sure that all fields in your entities are properly recognized and compiled by Wasp. 3. If you're still encountering issues, consider creating a minimal reproduction of your issue and submitting it as a bug report on the Wasp Github page. Remember to always backup your work before making any major changes to your project. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Conspyre, 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
miho2w ago
If you have two different branches with different schemas, you can reset the DB on each change using wasp db reset to delete all the data and reapply the migrations from zero so you get a clean DB each time. You'll need to be more specific here:
Now I am getting a seemingly endless series of errors on code which isn't changed by this branch, all of the form "import foo from '../somewhere/somthing".
Please provide us with the actual code so we can give a more precise answer.
martinsos
martinsos2w ago
I will mention @sodic here though, he might have some good initial ideas. @Conspyre what I find peculiar here is that wasp clean doesn't help -> I can possibly imagine some stuff breaking on branch switch, although ideally it shouldn't, but might be a bug on our side -> however, wasp clean not helping, that is weird. So it would be ideal @Conspyre if you could possibly provide us with an example we can reproduce ourselves -> simple Wasp app + steps to cause the issue. This can be a lot of work though, so next best is just more details on your situation. Detailed error text + as much pieces of code, or video also might be amazing.
Filip
Filip2w ago
Hey @Conspyre, I agree: we need more data (Wasp version, error message, project code). Unfortunately, I can't reproduce the error from this description. Thanks!
Want results from more Discord servers?
Add your server