Skip to content
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

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

Open
zmk-punchbowl opened this issue Feb 14, 2022 · 22 comments · Fixed by #1129 · May be fixed by #1134
Open

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

zmk-punchbowl opened this issue Feb 14, 2022 · 22 comments · Fixed by #1129 · May be fixed by #1134

Comments

@zmk-punchbowl
Copy link

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
Copy link
Member

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.

@timothyis timothyis changed the title Unhandled Promise Rejection mac-screen-capture-permissions causing Unhandled Promise Rejection Mar 14, 2022
@mmeyer724
Copy link

mmeyer724 commented Apr 1, 2022

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
Copy link

0-Chan commented May 1, 2022

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

(macOS 12.3.1, M1)

@Bolza
Copy link

Bolza commented May 27, 2022

Same issue here
(macOS 12.4, M1)

@jaro-io
Copy link

jaro-io commented May 30, 2022

for me a simple reinstall fixed the problem. 🤷‍♂️

@0-Chan
Copy link

0-Chan commented Jun 2, 2022

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

@nyjr10025
Copy link

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

@djpowers
Copy link

djpowers commented Jun 2, 2022

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
Copy link

djpowers commented Jun 4, 2022

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 #1106, which was marked as a duplicate of #1070, but this does appear to be a distinct issue based on the trace.)

@pedros007
Copy link

pedros007 commented Jun 9, 2022

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
Copy link
Contributor

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
Copy link

xstast24 commented Aug 15, 2022

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
Copy link
Contributor

thethomasz commented Aug 16, 2022

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 github/roadmap#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
Copy link

xstast24 commented Aug 16, 2022

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

  • if Rosetta (x86_64 emulator) is NOT installed, Kap raises the exception and doesn't work at all
  • if Rosetta is installed, Kap works
    --> Kap is not working on the pure ARM, but it works with the Rosetta emulator "workaround".

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

thethomasz added a commit to thethomasz/Kap that referenced this issue Aug 28, 2022
thethomasz added a commit to thethomasz/Kap that referenced this issue Aug 28, 2022
thethomasz added a commit to thethomasz/Kap that referenced this issue Aug 28, 2022
thethomasz added a commit to thethomasz/Kap that referenced this issue Aug 29, 2022
@philfreo
Copy link

philfreo commented Jan 21, 2023

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

@lx-wnk
Copy link

lx-wnk commented Jan 26, 2023

This error also occurs for me

  • MacBook Pro (M1 Pro - 2021)
  • macOS Ventura 13.1
  • Kap version: 3.6.0
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

  • MacBook Pro (M1 Pro - 2021)
  • macOS Ventura 13.5.2
  • Kap version: 3.6.0

@Qwertic
Copy link

Qwertic commented Sep 13, 2023

After reinstalling the app the issue is not present anymore

@alvarotrigo
Copy link

alvarotrigo commented Jan 22, 2024

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)

@g-guerzoni
Copy link

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:

  • Run in the terminal: softwareupdate --install-rosetta
  • Re-open the app

@khurshid-alam
Copy link

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

@pixelbud
Copy link

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

@lamguy
Copy link

lamguy commented Nov 9, 2024

Confirmed working for M4 with Rosetta 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet