#Is there any way to trace where permissions prompts are coming from?
12 messages · Page 1 of 1 (latest)
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?
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) >
I can disable the prompt with --no-prompt but I'd like to fix this so others don't need to use that option
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
Search for where you're using cwd
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
Depending on what kind of project you‘re working on, you could also use the debugger by setting a breakpoint at L1 of your main file and just stepping into called functions until you get to the Deno.cwd() call
Wait, why would a npm dependency access Deno.cwd()? Or does the npm compat thing alias process.cwd() to that
I'm guessing compat is the cause
you could also deno bundle and search for Deno.cwd() in the output