Initial rw auth request is slow, but getCurrentUser is fast

Hi there!

I have an app that is served via Verceli on the Web and with Capacitor too to iOS + Android.

My issue is that when my Redwood application loads the initial __REDWOOD__AUTH_GET_CURRENT_USER takes 7-9 seconds on the web, and for the mobile apps when the users repoen it from the background it also hits that gql request and takes the same time. The app just hangs in a blank state without redirecting to login, or opening the dashboard up.

The interesting part is that getCurrentUser takes only 200-400ms. (It’s only an upsert query with and indexed join.)

I also have some queries that run right after login, and are slow the same way but the next ones a bit later get fixed and load fast. Pretty weird for me, tried to debug but no luck yet.

Here’s some info about what happens with the login states, and the session, etc on the frontend:

Here’s my stack, that can be connected to this issue:

  • Deployment: Vercel Pro plan
  • Database: Supabase, 4gb memory DB plan,
  • DATABASE_URL: postgres://postgres.SECRET:SECRET@aws-0-eu-central-1.pooler.supabase.com:6543/postgres?pgbouncer=true&connection_limit=1
  • Auth: Supabase, custom domain
  • Extra in GraphQL implementation:
    • context: custom transactionId generator (sync fn, random md4)
    • extraPlugins:
 useSentry({ includeRawResult: true, includeResolverArgs: true, includeExecuteVariables: true })

Thanks if you can help! :crown:

p.s.: besides this I absolutely love RWJS, have 3 businesses running it and still finding oppurtunities to use is as the main framework.

1 Like

Hi @akosbalogh, welcome!! Great to have you here :slight_smile:

Are you finding that this is happening when there hasn’t been usage for a bit? Sounds like a serverless cold boot issue.

I was dealing with similar issues and eventually just gave up on serverless.