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

Problem with Deno and edge functions after project update #203

Open
zechkonja opened this issue Nov 1, 2023 · 3 comments
Open

Problem with Deno and edge functions after project update #203

zechkonja opened this issue Nov 1, 2023 · 3 comments

Comments

@zechkonja
Copy link

zechkonja commented Nov 1, 2023

Describe the bug
After we updated supabase project and deployed our edge function we have got this error

event loop error: TypeError: Deno.stat is not a function
at Connection.#openSocketConnection (https://deno.land/x/postgres@v0.17.0/connection/connection.ts:172:35)
at Connection.#startup (https://deno.land/x/postgres@v0.17.0/connection/connection.ts:222:45)
at Connection.startup (https://deno.land/x/postgres@v0.17.0/connection/connection.ts:360:40)
at PoolClient.connect (https://deno.land/x/postgres@v0.17.0/client.ts:161:36)
at https://deno.land/x/postgres@v0.17.0/pool.ts:165:30
at Function.from ()
at Pool.#initialize (https://deno.land/x/postgres@v0.17.0/pool.ts:160:31)
at new Pool (https://deno.land/x/postgres@v0.17.0/pool.ts:87:39)

this is code that we are using

import { Pool } from "postgres";
import { serve } from "server";

const pool = new Pool(
  {
    tls: { enabled: false },
    database: "postgres",
    hostname: Deno.env.get('DB_HOST'),
    user: "postgres",
    port: 5432,
    password: Deno.env.get('DB_PASSWORD'),
  },
  1
);

and these are import maps:

{
    "imports": {
      "server": "https://deno.land/std@0.199.0/http/server.ts",
      "postgres": "https://deno.land/x/postgres@v0.17.0/mod.ts"
    }
  }

Please help :D

@zechkonja
Copy link
Author

image-Oct-30-2023-09-06-23-7550-PM

@sweatybridge sweatybridge transferred this issue from supabase/cli Nov 8, 2023
@sweatybridge
Copy link

Moving this to edge runtime repo since it seems to affect hosted project.

@zechkonja
Copy link
Author

After i removed DB_HOST and set real db host string, and after i've done for all 4 env variables. My function start to work correctly...

But again, i don't like to have hardcoded things in function.
For some reason it could not read en vars

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

No branches or pull requests

2 participants