Local PostgREST returns PGRST301 (Invalid JWT parts) when createClient sb_secret/sb_publish

What I’m trying to do

  • Run a local Supabase (via supabase CLI) and have a Node/Express backend query a table (projects) using @supabase/supabase-js.
  • Verify health with a small script that does a simple select: id, updated_at from projects limit 1.
What’s going wrong
  • The SDK initializes, but the REST query fails with:
  • JWSError (CompactDecodeError Invalid number of parts: Expected 3 parts; got 1)
  • Code: PGRST301
  • This points to PostgREST rejecting the Authorization token (not a valid JWT).
  • I’m using the new-style local keys supabase status prints: sbpublishable... and sbsecret...
  • If these keys end up in Authorization: Bearer ..., the error occurs.
Environment
  • OS: macOS
  • Framework: Node/Express (backend)
  • Library version:
  • @supabase/supabase-js: ^2.57.1
  • Running locally with supabase CLI (self-hosted dev) supabase --version 2.45.5
It was working before(yesterday)
But stopped working after I nuked my local environment and started from scratch.

CODE:
# values are 
const client = createClient(
      "http://0.0.0.0:54321/",
      "sb_publishable_ACJWlzQHlZjBrEguHvfOxg_3BJgxAaH",
      {
        auth: {
          debug: true,
          persistSession: false,
          autoRefreshToken: false,
          detectSessionInUrl: false
        }
      }
    );


Tried different variations but for whatever reason it errors out.
Hot to get JWT tokens from Supabase CLI?


SOLVED: by downgraded cli version to 2.39.2
Was this page helpful?