You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using NeonPostgres and connecting to the database in Deno using the following below and executing this way. This connection is running in a Discord bot using Discordeno. I am entirely ruling out local network setup however the discord bot itself never disconnects. So that brings me here. After a certain time frame that I haven't determined quite yet. Maybe 20 minutes or so?
import{Pool}from"https://deno.land/x/[email protected]/mod.ts";constpool=newPool({database: Deno.env.get("POSTGRES_DATABASE"),hostname: Deno.env.get("POSTGRES_HOST"),port: 5432,user: Deno.env.get("POSTGRES_USER"),password: Deno.env.get("POSTGRES_PASSWORD"),connection: {attempts: 10,},options: {}},10);export{pool};import{QueryArrayResult}from"https://deno.land/x/[email protected]/mod.ts";import{pool}from"../database/database.ts";exportclassChatMessageRepository{publicstaticasyncgetChatMessagesByChannelIdAndUserId(channelId: bigint,userId: bigint): Promise<QueryArrayResult<unknown[]>>{constclient=awaitpool.connect();constchatMesages=awaitclient.queryArray(`SELECT "Content", "IsBot" FROM public."ChatMessages" WHERE "ChannelId" = ${channelId} AND "UserId" = ${userId} ORDER BY "CreatedAt" ASC;`,);client.release();returnchatMesages;}}
ConnectionError: The session was terminated unexpectedly
0|chatbot | throw new ConnectionError("The session was terminated unexpectedly");
0|chatbot | ^
0|chatbot | at Connection.#readMessage (https://deno.land/x/[email protected]/connection/connection.ts:186:13)
0|chatbot | at eventLoopTick (ext:core/01_core.js:168:7)
0|chatbot | at async Connection.#preparedQuery (https://deno.land/x/[email protected]/connection/connection.ts:953:25)
0|chatbot | at async Connection.query (https://deno.land/x/[email protected]/connection/connection.ts:979:18)
0|chatbot | at async PoolClient.#executeQuery (https://deno.land/x/[email protected]/client.ts:256:12)
0|chatbot | at async PoolClient.queryArray (https://deno.land/x/[email protected]/client.ts:339:12)
Expected behavior
I would expect the pool to maintain its "main" connection to the server so clients can connect on demand.
deno-postgres version: 0.19.3
deno version: 1.43.1
The text was updated successfully, but these errors were encountered:
Describe the bug
I am using NeonPostgres and connecting to the database in Deno using the following below and executing this way. This connection is running in a Discord bot using Discordeno. I am entirely ruling out local network setup however the discord bot itself never disconnects. So that brings me here. After a certain time frame that I haven't determined quite yet. Maybe 20 minutes or so?
Expected behavior
I would expect the pool to maintain its "main" connection to the server so clients can connect on demand.
The text was updated successfully, but these errors were encountered: