Open carere opened 8 months ago
I think env vars need to be set manually in Deploy. https://docs.deno.com/deploy/manual/environment-variables
I did defined all my variables, the problem does not come from env var, is just the function querySync
which is not available.
Is there a way to quickly patch this ??
For those encountering the same issue, here is my workaround while waiting this problem is solved on deno side:
// Horrible hack in order to fix `Deno.permissions.querySync` not being defined
if (!Deno.permissions.querySync) {
(Deno.permissions as unknown as Record<string, unknown>)["querySync"] = (
_pd: Deno.PermissionDescriptor,
): { state: string } => ({ state: "granted" });
}
// End horrible hack
Put it at the first line of your entry-point ;)
I had the same error while deploying when trying to use Sentry from deno.land
⠦ Finishing deployment...
⠧ Finishing deployment...
✖ Deployment failed.
error: The deployment failed: UNCAUGHT_EXCEPTION
TypeError: Deno.permissions.querySync is not a function
at Object.makeFetchTransport [as transport] (https://deno.land/x/sentry@7.85.0/index.mjs:9785:24)
at new BaseClient (https://deno.land/x/sentry@7.85.0/index.mjs:7425:33)
at new ServerRuntimeClient (https://deno.land/x/sentry@7.85.0/index.mjs:8123:5)
at new DenoClient (https://deno.land/x/sentry@7.85.0/index.mjs:8823:5)
at initAndBind (https://deno.land/x/sentry@7.85.0/index.mjs:8367:18)
at Module.init (https://deno.land/x/sentry@7.85.0/index.mjs:9908:3)
at init (file:///src/src/core/tracing.ts:10:10)
at file:///src/src/main.ts:12:1
at eventLoopTick (ext:core/01_core.js:178:11)
I had the same error while deploying when trying to use Sentry from deno.land
⠦ Finishing deployment... ⠧ Finishing deployment... ✖ Deployment failed. error: The deployment failed: UNCAUGHT_EXCEPTION TypeError: Deno.permissions.querySync is not a function at Object.makeFetchTransport [as transport] (https://deno.land/x/sentry@7.85.0/index.mjs:9785:24) at new BaseClient (https://deno.land/x/sentry@7.85.0/index.mjs:7425:33) at new ServerRuntimeClient (https://deno.land/x/sentry@7.85.0/index.mjs:8123:5) at new DenoClient (https://deno.land/x/sentry@7.85.0/index.mjs:8823:5) at initAndBind (https://deno.land/x/sentry@7.85.0/index.mjs:8367:18) at Module.init (https://deno.land/x/sentry@7.85.0/index.mjs:9908:3) at init (file:///src/src/core/tracing.ts:10:10) at file:///src/src/main.ts:12:1 at eventLoopTick (ext:core/01_core.js:178:11)
I also encountered this with Sentry from Deno.land, I opened an issue on the Sentry-Deno . https://github.com/getsentry/sentry-javascript/issues/10521
@carere I am facing the same issue with edgedb. Your hack worked like a charm! Thanks a lot!
For those encountering the same issue, here is my workaround while waiting this problem is solved on deno side:
// Horrible hack in order to fix `Deno.permissions.querySync` not being defined if (!Deno.permissions.querySync) { (Deno.permissions as unknown as Record<string, unknown>)["querySync"] = ( _pd: Deno.PermissionDescriptor, ): { state: string } => ({ state: "granted" }); } // End horrible hack
Put it at the first line of your entry-point ;)
I believe that Deno Deploy generally doesn't support sync APIs.
However, I remember that at some point, query
was just implemented via a sync operation wrapped inside a call to Promise.resolve
(at least in the CLI). Assuming that Deno Deploy is built similarly, it sounds reasonable to me that querySync
should be supported on Deno Deploy. This won't be any more sync than the async API, and it will improve compatibility with some libraries.
Everything is in the title, I'm deployed an API, and my database is EdgeDB, when I try to establish a connection with it, Edgedb try to read some env var. Thus, it call
Deno.permissions.querySync
, and I get the error highlighted in the title. Here is my stack trace for more info.It's really annoying, since my API is totally unusable actually... Is there a way to fix this ? Is this normal ? Should I do something on Deno Deploy ? If yes what ?
Best regards,