Problem with Deno and edge functions after project update
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/[email protected]/connection/connection.ts:172:35)
at Connection.#startup (https://deno.land/x/[email protected]/connection/connection.ts:222:45)
at Connection.startup (https://deno.land/x/[email protected]/connection/connection.ts:360:40)
at PoolClient.connect (https://deno.land/x/[email protected]/client.ts:161:36)
at https://deno.land/x/[email protected]/pool.ts:165:30
at Function.from (
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/[email protected]/http/server.ts",
"postgres": "https://deno.land/x/[email protected]/mod.ts"
}
}
Please help :D
Moving this to edge runtime repo since it seems to affect hosted project.
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
This appears to be because the postgres package was trying to refer Deno.stat.
In the edge runtime, this API is disabled due to security issues with the file system.
Closing this issue for housekeeping.