New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Intermittent failures of CLI commands for large schemas (M2 Mac - 4.10.1) #17869
Comments
We had another report of this error message via Slack today. I pointed that user here and hope they will comment with a description of their environment and if their experience matches what was happening for you. Initially, this looks weird, as we do not have any C code in our project. Googling for the first line of the error message returns these 2 random issues from other projects: PowerShell/PowerShell#17655 + ethereum/solidity#13523 I see no overlap with what you describe here though, so am a bit clueless. |
The user from Slack provided some more environment information:
They also included this link: quarto-dev/quarto-cli#2296 There a similar error message was caused by a project using a Rust launcher - and they fixed it by reverting to a bash script. |
@zackdotcomputer Can you maybe set With that output we could maybe pinpoint which part of our code throws this - we have 2 big Rust blocks (one via a Wasm module, the other via a Node-API library or binary - and knowing which one would be super useful). Thanks! |
Sure thing @janpio - when I get into work I will gather that info for you. |
I'm having this same issue in a monorepo, but only sometimes when running prisma generate. I have 15 models. There's about a 50/50 chance of it occurring for me. Prisma: v4.10.1 |
@janpio here's the full-printout from that run:
|
Following up - based on the theory that it might be
|
Ok diving deeper - sorry for multiple posts, but figured that was the best way to catalog what I find for the team - I was able to use the above stack traces and some console debug logs to pinpoint the last TS line touched before the crashes. In both cases it was a call to So with high confidence I can guess that something in the instantiation or the running of the WASM instance is causing a crash here. However, we're at the edge of my ability to dive deeper, so I'll have to hand this off to you @janpio. If you can track down the underlying issue (which, I assume, is actually with Rust or WasmBindgen) and fix with the providing company, then that is great! If not, then perhaps we could at least get a quick fix to disable use of the WASM binaries for the getDmmf and getConfig steps on M1/M2 chips for now? |
I THINK I SOLVED IT! Looking through the issues you posted above @janpio, I noticed that the Quarto issue referenced having the Rosetta x64 -> aarch64 translation layer inside of your build stack seemed to be related to the crash. I also looked at Apple's Console.app and noticed that it had been capturing all of the crashes and, according to it, I ran I wiped out node from my system (remove from brew, remove manually installed, remove installed via I'll leave this open in case there's something you want to investigate still, but on my end I think the issue is resolved. |
Thanks for doing the investigation for us @zackdotcomputer :D Both
Does that mean that In quarto-dev/quarto-cli#2420 (comment), a sub issue of the linked quarto one, there is a discussion around |
Yeah @janpio - asking Node to print out its architecture showed that it was running in an emulated x64 arch, not the arm64 one. I think we can close this one now. I'll just leave that tip for anyone who runs into this in the future since we now easily top the Google search results for this error 😅 |
Considering we have 2 more people that reported this problem, I'll reopen this already and see if they can confirm your fix actually. We at Prisma might also want to catch this case ourselves - assuming it is reproducible (which requires us to get to the crash ourselves by somehow installing Node the way you automatically already had it. 🤔 ) |
Another way I think this may happen is if you somehow have two of the same node versions installed (which is somehow the case for me). iTerm2 output $ ~: node -v
v18.14.0
$ ~: node -e 'console.log(process.arch)'
arm64 Output in VSCode in my project $ kiai: node -v
v18.14.0
$ kiai: node -e 'console.log(process.arch)'
x64 |
Interesting @net-tech - I wonder if that's actually one install but it's a "universal binary" which contains both architectures? Could you run |
Same files on the disk it seems VSCode $ kiai: which node
/usr/local/bin/node iTerm2
Really wish someone made a node uninstaller that uninstalled node from every corner of your computer. I'm not sure how I uninstalled node back in the day but I have tons of versions, some installed with |
@janpio I was able to go back to having the issue using the following steps, which someone on the Prisma team could use to reproduce:
Or, as @net-tech has shown, apparently if you install the universal binary from Node's website, it will just reflect the environment of the host program. This might allow you to switch into x64 node just using the arch command above but I haven't tested that. |
Thanks. With the description we understand what is happening - it's quite obviously the "wrong" node running - but we are not super sure what we should do about it really. Should we try to educate you? It seems that usually this does not cause any problems to you - just in the case of Rust based binaries it sometimes leads to this weird error message :/ |
Yeah agreed that this is not really Prisma's bug - it's a user confusion issue or an Apple migration issue, combined with an unfortunate interaction between Rust and the x64 Rosetta emulator. If you can think of a way to easily notify the user of this, then I think being able to intercept and warn about it would be helpful education for users. My first-thought ideas for how to detect this would be:
Ultimately, though, I suspect that finding this thread via Google will help educate as well, and so the impact and lift of making this change is probably pretty low. If you want to mark this as resolved, I think that would be a reasonable prioritization. |
Had same issua on an m1 mac, fixed it by changing node version to 19.7.0. next time i run it, it auto downloaded arm specific version of some files. |
@victorhs98 for some reason it does not work for me when using 19.7.0 |
I also had this issue on an M2 mac. The problem was that node was on x64. If you install again via npm it should be on arch64. Check with this command: node -e 'console.log(process.arch)' |
Migrated from a previous Intel mac with homebrew -> fish -> asdf -> node and was running into this issue. Going and reinstalling everything to be I don't think this is necessarily the responsibility of prisma, just a gotcha for M1/M2 mac owners that upgrade. The error message is particularly unfriendly, but the solution is to make sure this comes up in search and then people will discover the need to fix their node install (with dependencies). |
I also had this issue on an M2 mac in docker container with "Use Rosetta for x86/amd64 emulation on Apple Silicon" turned on. Repeats every 4-5 docker build node js project for amd64 arch (lambda). Without rosetta docker very slow on my mac :( |
Hi guys, I resolved this problem with re-installing # Change my terminal to arm64
$ arch -arm64e /bin/zsh
$ uname -mp
arm64 arm
# Re-install my node on darwin-arm64 mode
$ nodenv uninstall 18.15.0
$ nodenv install 18.15.0
Downloading node-v18.15.0-darwin-arm64.tar.gz...
...
# Check node arch
$ node -e 'console.log(process.arch)'
arm64
# Re-install node_modules
$ rm -rf ./node_modules
$ npm i
# After that my Prisma commands succeeds 100%! |
Big thanks for the diagnosis @zackdotcomputer - gave me the immediate solution after I hit this while updating from Node 16 -> 18. Turns out the root cause was I somehow had the x86 version of VSCode installed on my M1 Mac 🤦♂️ - which in turn led to having the x86 version of node installed when I used nvm within a VSCode terminal. |
@rskvazh Did you find any solution or workaround? Having the same problem on M1 when building docker images with
|
I'm having the same problem (mac m2), with a single version of node in use.
I have deleted node_modules and .next and reinstalled. My error message is:
I removed and resinstalled node (brew) but can't find the flag setting to make it use arm. I have tried installing a separate version of homebrew that accepts arm. I am stuck at that step because it needs rosetta 2 to be installed before node (with arm) can be installed. When I try to install rosetta 2, I get an error that says Installing Rosetta 2 on this system is not supported. The help on this error says that I can solve this by unchecking the box in the terminal application that uses rosetta 2. I've done this, and restarted vscode, and still can't install rosetta. I tried adding binary targets to the generator as follows, but I still cant get prisma to work on m2 mac:
thank you |
Just for people looking for a solution:
|
Thanks @zackdotcomputer, this resolved the issue! |
If hope this can help someone : I had the same error on my macbook pro using the M1 max. I tried to add these two field in my model : fidelity_activated Boolean @default(false)
game_activated Boolean @default(false) Then when I did
To quick fix this:
fidelity_enabled Boolean @default(false)
game_enabled Boolean @default(false) And it worked ! |
Confirmed, also ran into this is on the apple M3 pro chip. @zackdotcomputer's fix worked good link here on removing node manually, from homebrew and NVM. then a reinstall with nvm and everything works as it should |
I have the same issue. But I look it solved above comments! |
+1 I'm running into this issue building a docker image on an M1 Mac using |
Wiping out my |
For those deploying to AWS Fargate, it now supports arm64 architecture (https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-arm64.html). You no longer need to change the architecture when deploying. |
Documenting this for my own benefit as much as anyone else as I know I'm going to end up finding myself here again in the near future. Some of this may be cargo-culty in as much as I don't know if all the steps are required to make it work but this is what I did on my last successful run at it. I'm running an M1 Pro but trying to build a Remix JS / Prisma application docker image that's run on a linux server running Portainer. The build process seems particularly fragile. I'd successfully deployed at least three times but then this morning it stopped working again and I found myself back here. Piecing together from several answers above, I tried building from start to finish under different node architectures but both x64 and arm64 would fail at one stage or other for seemingly different reasons. This time it worked though and this is what I did:
Quit Terminal app and locate the app. Get info on it and change it to use Rosetta. Open Terminal. Confirm architecture is x64 with The version of node the project is pinned at is 18.16 with the .nvmrc file. Looking inside
Now I have the
Then I removed the node version again, and the cached x64 version. Switch back to arm64 by quitting terminal, changing it back to native and relaunching (or using a different app [PHP Storm] terminal that's already reporting arm64.
Then ran the push command to get it up to EC2 for distribution. I won't detail that command as it's probably not pertinent. |
My # arch="$(uname -m)"
arch="arm64" it work like a charm. compilation speed increased in 70% or more. |
If you're using
Fixed this issue for me. Should only work for node versions 16 and higher. Also very likely if you did a straight through migration of your dev setup from an x86 mac beforehand. |
Bug description
When running
prisma
CLI commands via annpm
script, I receive intermittent fatal errors:or
If I
rm -rf
the client directory and downgrade back to 4.9.0, they stop occurring.How to reproduce
https://github.com/prisma/prisma-examples/tree/latest/typescript/rest-nextjs-api-routes
example projectIt seems to be related to:
extendedWhereUnique
(Preview feature feedback: Extended where unique #15837) - disabling this dropped the failure rate dramaticallyExpected behavior
I would expect the command to predictably succeed or fail.
I would expect the command to succeed if there are no errors in the schema.
Prisma information
Environment & setup
Prisma Version
The text was updated successfully, but these errors were encountered: