Tim Fish
Tim Fish2y ago

Is there any way to trace where permissions prompts are coming from?

I'm running some code through Deno and its prompting for some permissions. How can I find out where these are coming form?
9 Replies
raunioroo
raunioroo2y ago
not 100% sure, but I think if you run without --prompt ( --no-prompt was removed in favour of --prompt IIRC ), or decline permission, doesn't it throw an exception with a stack trace pointing to the culprit?
Tim Fish
Tim FishOP2y ago
I'm getting the following and I want to know what code is causing the prompt so I can fix it:
⚠️ ┌ Deno requests read access to <CWD>.
├ Requested by `Deno.cwd()` API
├ Run again with --allow-read to bypass this prompt.
└ Allow? [y/n] (y = yes, allow; n = no, deny) >
⚠️ ┌ Deno requests read access to <CWD>.
├ Requested by `Deno.cwd()` API
├ Run again with --allow-read to bypass this prompt.
└ Allow? [y/n] (y = yes, allow; n = no, deny) >
I can disable the prompt with --no-prompt but I'd like to fix this so others don't need to use that option
raunioroo
raunioroo2y ago
what happens if you deny? should throw an permission error. oh yeah, if the culprit is inside try catch block, it can be silent. so, yeah I'm dumb hopefully someone else can answer if it's possible to see the origin of permission prompt
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Tim Fish
Tim FishOP2y ago
The only place I call Deno.cwd(), I query that permissions are granted first. Best guess is that this comes from an npm dependency But without a stack trace I'm not sure
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Tim Fish
Tim FishOP2y ago
I'm guessing compat is the cause
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Tim Fish
Tim FishOP2y ago
Deno bundle doesn't work with npm dependencies yet