wulkano / Kap

An open-source screen recorder built with web technology
https://getkap.co
MIT License
18k stars 822 forks source link

`mac-screen-capture-permissions` causing Unhandled Promise Rejection #1095

Open zmk-punchbowl opened 2 years ago

zmk-punchbowl commented 2 years ago

Sentry Issue: KAP-BPC

macOS version: Monterey (12) Kap version: 3.5.3

Unhandled Promise Rejection

Error: Command failed: /Applications/Kap.app/Contents/Resources/app.asar.unpacked/node_modules/mac-screen-capture-permissions/screen-capture-permissions
spawnSync /Applications/Kap.app/Contents/Resources/app.asar.unpacked/node_modules/mac-screen-capture-permissions/screen-capture-permissions Unknown system error -86
    at Function.module.exports.sync (/Applications/Kap.app/Contents/Resources/app.asar/node_modules/mac-screen-capture-permissions/node_modules/execa/index.js:168:25)
    at exports.hasScreenCapturePermission (/Applications/Kap.app/Contents/Resources/app.asar/node_modules/mac-screen-capture-permissions/index.js:27:25)
    at ensureScreenCapturePermissions (/Applications/Kap.app/Contents/Resources/app.asar/dist-js/common/system-permissions.js:64:23)
    at /Applications/Kap.app/Contents/Resources/app.asar/dist-js/index.js:102:65
timothyis commented 2 years ago

Could this possibly be fixed by updating mac-screen-capture-permissions @karaggeorge? Asking since it's your package so you may know a bit more here.

mmeyer724 commented 2 years ago

As a troubleshooting step I tried manually granting Kap screen recording access (System Prefs -> Security -> Screen Recording -> Click '+' and add Kap.app), but that did not help unfortunately

I'm running macOS 12.3 on an M1 Pro MacBook

0-Chan commented 2 years ago

I have the same problem here. Adding kap.app to security didn't help either. Any progress?

(macOS 12.3.1, M1)

Bolza commented 2 years ago

Same issue here (macOS 12.4, M1)

jaro-io commented 2 years ago

for me a simple reinstall fixed the problem. :man_shrugging:

0-Chan commented 2 years ago

Wow... reinstall really fixes the problem. Thanks!

nyjr10025 commented 2 years ago

Confirmed on MacOS, 12.3.1, M1 that a reinstall fixes permissions issue mentioned above

djpowers commented 2 years ago

I'm still seeing this on macOS 12.4 on an M1 computer. I tried a full reinstall, and also manually adding the screen recording permissions for Kap, but no luck. This machine currently does not have Rosetta installed, which could possibly be a factor (another machine with the same specs that does have Roesetta installed is not having this problem).

djpowers commented 2 years ago

Digging into this a little more, the Unknown system error -86 messaging makes me fairly confident this is due to some upstream dependency not being compatible with M1 machines. I suspect installing Rosetta would resolve this (ideally Rosetta would not be required, or at least a more graceful failure would be in place). I've seen this error on other applications though that required Rosetta in order to work.

(The "collect and report" option for this crash takes me to https://github.com/wulkano/Kap/issues/1106, which was marked as a duplicate of https://github.com/wulkano/Kap/issues/1070, but this does appear to be a distinct issue based on the trace.)

pedros007 commented 2 years ago

I ran into this after upgrading from Big Sur to Monterey on an Intel MacBook. I was eventually able to get things working after trying the following a few times:

rm -rf /Applications/Kap.app
brew install --cask kap
open /Applications/Kap.app

When the System Preferences Privacy dialogue came up, I pressed - to remove Kap. I then clicked + to add /Applications/Kap.app. Quit Kap & re-open. I tried variations of this a few times and it didn't work... so your mileage may vary!

Also, the Kap issue tracker has a bunch of seemingly duplicate issues related to this problem.

sindresorhus commented 2 years ago

I had to revert #1129 as it causes problem when built for production. The binary used in the capture permission thing could not be found and I don't have time to look into it. If someone wants to work on this, make sure you test the change by running npm run dist and try launching the app in the dist folder.

xstast24 commented 2 years ago

Hi, just confirming that this issue persists. MacBook Pro 2021 (Apple arm CPU, Mojave OS). Kap doesn't work at all. I tried to reinstall Kap / reallow permissions / reboot mac around 10 times in various orders (as suggested above), but it didn't help. I love Kap and am looking forward to using it again, I hope somebody knows how to fix this. Thanks in advance, fingers crossed 😉 🤞 EDIT: It works if Rosetta emulator is installed (see comments below) 🎉

thethomasz commented 2 years ago

Woops, didn't notice the prebuilts for that package weren't uploaded. I tried to see if it was possible to fix the github action that creates the prebuilts, but the prebuild library fails to upload the binaries to the release, and I'm not entirely sure why. Also, I don't think github has ARM Mac runners yet (can track it here https://github.com/github/roadmap/issues/528), so we'd also need to upload the prebuilts from our own self hosted ARM Mac, or just skip using prebuilts on ARM Macs.

Although with version 3.5.5, the error doesn't seem to come up for me anymore. For anyone that had issues installing Kap 3.5.4, try installing 3.5.5 to see if it fixes the issue. If the issue persists, we might need to address the issues I mentioned above, or use this library instead https://github.com/codebytere/node-mac-permissions#permissionsaskforscreencaptureaccess.

xstast24 commented 2 years ago

Hi, tested on Macbook Pro 2021 (arm CPU, MacOS Mojave) with Kap 3.5.5 as suggested by @thethomasz:

PS: To install Rosetta, run softwareupdate --install-rosetta --agree-to-license

philfreo commented 1 year ago

Any chance of getting a fix for this for Macs without Rosetta installed?

lx-wnk commented 1 year ago

This error also occurs for me

Unhandled Promise Rejection
Error: Command failed: /Applications/Kap.app/Contents/Resources/app.asar.unpacked/node_modules/mac-screen-capture-permissions/screen-capture-permissions
spawnSync /Applications/Kap.app/Contents/Resources/app.asar.unpacked/node_modules/mac-screen-capture-permissions/screen-capture-permissions Unknown system error -86
    at Function.module.exports.sync (/Applications/Kap.app/Contents/Resources/app.asar/node_modules/mac-screen-capture-permissions/node_modules/execa/index.js:168:25)
    at exports.hasScreenCapturePermission (/Applications/Kap.app/Contents/Resources/app.asar/node_modules/mac-screen-capture-permissions/index.js:27:25)
    at ensureScreenCapturePermissions (/Applications/Kap.app/Contents/Resources/app.asar/dist-js/common/system-permissions.js:64:23)
    at Object.openCropperWindow [as open] (/Applications/Kap.app/Contents/Resources/app.asar/dist-js/windows/cropper.js:81:66)
    at Object.openCropperWindow (/Applications/Kap.app/Contents/Resources/app.asar/dist-js/tray.js:26:129)

UPDATE (25.09.23): For me the issue is resolved. I'm currently on

Qwertic commented 1 year ago

After reinstalling the app the issue is not present anymore

alvarotrigo commented 8 months ago

I did two things and the error went away:

g-guerzoni commented 5 months ago

I did two things and the error went away:

  • Restarted my Mac (MacBook Pro M2)
  • Installed Rosetta for old intel apps (even though I'm using the latest KAP version for Apple Silicon)

@alvarotrigo Thanks, it worked.

For those who want to make this workaround:

khurshid-alam commented 4 months ago

Same error on MacBook Air M1. And Rosetta crashes on me. So doesn't work.

pixelbud commented 3 months ago

Installing Rosetta via Terminal worked for me. Did not have to reinstall or re-open the app.