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

Uncaught Exception "Deno.permissions.querySync is not a function" on Deno Deploy #1126

Open
igorbdl opened this issue Oct 30, 2024 · 1 comment

Comments

@igorbdl
Copy link

igorbdl commented Oct 30, 2024

Describe the bug
When trying to use the client library on Deno Deploy, there is the following error:

TypeError: Deno.permissions.querySync is not a function
    at getEnv (https://deno.land/x/[email protected]/_src/adapter.shared.deno.ts:3:36)
    at parseConnectDsnAndArgs (https://deno.land/x/[email protected]/_src/conUtils.ts:504:21)
    at ClientPool._parseConnectArguments (https://deno.land/x/[email protected]/_src/conUtils.ts:99:17)
    at ClientPool._getNormalizedConnectConfig (https://deno.land/x/[email protected]/_src/baseClient.ts:364:46)
    at ClientPool.getNewConnection (https://deno.land/x/[email protected]/_src/baseClient.ts:375:31)
    at ClientConnectionHolder._getConnection (https://deno.land/x/[email protected]/_src/baseClient.ts:62:43)
    at ClientConnectionHolder.retryingFetch (https://deno.land/x/[email protected]/_src/baseClient.ts:175:31)
    at ClientConnectionHolder.query (https://deno.land/x/[email protected]/_src/baseClient.ts:219:17)
    at Client.query (https://deno.land/x/[email protected]/_src/baseClient.ts:594:27)
    at async file:///src/main.ts:5:16

Reproduction
Include the code that is causing the error:

import { createClient } from "https://deno.land/x/edgedb/mod.ts";

const client = createClient();

const result = await client.query("select 2 + 2");

console.log(result);

Deno.serve((req: Request) => new Response("It works!"));

Expected behavior
Being able to use the client library on Deno Deploy.

Additional context
Sentry had a similar issue with Deno Deploy which was fixed here.

It is possible to workaround the issue on Deno Deploy with this hack, but it would be much better if resolved on the library.

@scotttrinh
Copy link
Collaborator

Thanks for the bug report here! I'm a little bit annoyed that this well-documented, non-deprecated Deno API is not supported on Deno Deploy 😓 This means you would not be able to use environment variables to configure the connection which is our suggested way of doing client connection configuration in a production environment, so I don't really want to follow the way Sentry fixed this. However, it might be possible to use the async version with some general refactoring, so we'll take a look at that (PRs welcome!)

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

No branches or pull requests

2 participants