sidequestjs / sidequestjs/sidequest

Trouble using Supabase's Postgres transaction pooler

Open
#144 21 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1k
Forks
25
Avg merge
12h 17m
Merged PRs (30d)
5

Description

I'm trying to use Sidequest with Supabase's postgres transaction pooler. It works until it fails with the error relation "sidequest_jobs" does not exist.

I had the same error in my own code, so I know what is going on here: the relation does exist but not in the current schema. This is an issue with the transaction pooler, which might hand out a connection that was previously used on a different schema. Therefore you have to explicitly set the schema before you run a query.

I tried to figure out how to configure Knex to work with the transaction pooler. The safe approach would be to execute the query SET search_path to sidequest (replace sidequest with the respective config value). So far I couldn't figure out how to do that.

What is the right way to set up sidequest to work with a pooled connection?

Thanks in advance!

EDIT: another relevant thing to mention is that the transaction pooler does not support prepared statements

Here's the full error log:

[info] [2025-12-16 15:53:20] [Sidequest] [Worker] : Starting worker with provided configuration...
[error] [2025-12-16 16:00:00] [Sidequest] [Worker] : Error on running CleanupJob! delete from "sidequest_jobs" where ("completed_at" < $1 or "failed_at" < $2 or "canceled_at" < $3) - relation "sidequest_jobs" does not exist
{
  length: 113,
  name: 'error',
  severity: 'ERROR',
  code: '42P01',
  detail: undefined,
  hint: undefined,
  position: '13',
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  schema: undefined,
  table: undefined,
  column: undefined,
  dataType: undefined,
  constraint: undefined,
  file: 'parse_relation.c',
  line: '1449',
  routine: 'parserOpenTable',
  [Symbol(level)]: 'error',
  [Symbol(splat)]: [
    error: delete from "sidequest_jobs" where ("completed_at" < $1 or "failed_at" < $2 or "canceled_at" < $3) - relation "sidequest_jobs" does not exist
        at Parser.parseErrorMessage (/path/to/project/task-runner/node_modules/pg-protocol/dist/parser.js:285:98)
        at Parser.handlePacket (/path/to/project/task-runner/node_modules/pg-protocol/dist/parser.js:122:29)
        at Parser.parse (/path/to/project/task-runner/node_modules/pg-protocol/dist/parser.js:35:38)
        at Socket.<anonymous> (/path/to/project/task-runner/node_modules/pg-protocol/dist/index.js:11:42)
        at Socket.emit (node:events:524:28)
        at addChunk (node:internal/streams/readable:561:12)
        at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
        at Readable.push (node:internal/streams/readable:392:5)
        at TCP.onStreamRead (node:internal/stream_base_commons:189:23) {
      length: 113,
      severity: 'ERROR',
      code: '42P01',
      detail: undefined,
      hint: undefined,
      position: '13',
      internalPosition: undefined,
      internalQuery: undefined,
      where: undefined,
      schema: undefined,
      table: undefined,
      column: undefined,
      dataType: undefined,
      constraint: undefined,
      file: 'parse_relation.c',
      line: '1449',
      routine: 'parserOpenTable'
    }
  ]
}
error: delete from "sidequest_jobs" where ("completed_at" < $1 or "failed_at" < $2 or "canceled_at" < $3) - relation "sidequest_jobs" does not exist
    at Parser.parseErrorMessage (/path/to/project/task-runner/node_modules/pg-protocol/dist/parser.js:285:98)
    at Parser.handlePacket (/path/to/project/task-runner/node_modules/pg-protocol/dist/parser.js:122:29)
    at Parser.parse (/path/to/project/task-runner/node_modules/pg-protocol/dist/parser.js:35:38)
    at Socket.<anonymous> (/path/to/project/task-runner/node_modules/pg-protocol/dist/index.js:11:42)
    at Socket.emit (node:events:524:28)
    at addChunk (node:internal/streams/readable:561:12)
    at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
    at Readable.push (node:internal/streams/readable:392:5)
    at TCP.onStreamRead (node:internal/stream_base_commons:189:23)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Sidequest's Knex/Postgres connection configuration and the worker setup shown in the error log. Check how the configured schema and prepared-statement options are applied to pooled connections. Done means the worker can run against Supabase's transaction pooler without the sidequest_jobs relation error.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs, postgresql, supabase, typescript
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.