© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•5mo ago•
46 replies
Alex Lapchenko

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
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
        }
      }
    );
# 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
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Dynamic access to JWT Secret on SB remote
SupabaseSSupabase / help-and-questions
3y ago
Custom Supabase jwt returns invalid signature
SupabaseSSupabase / help-and-questions
4y ago
JWT secret format?
SupabaseSSupabase / help-and-questions
17mo ago
Invalid Jwt
SupabaseSSupabase / help-and-questions
6d ago