External Collection works in testing but fails with “Invalid API key” in Preview Mode

Hi everyone,

I’m experiencing a strange issue with an External Collection connected to Supabase in Adalo.

What works:

  • External Collection endpoint test inside Adalo succeeds

  • Supabase API key works correctly with curl/Postman

  • Endpoint itself responds correctly outside Adalo

Problem:

  • In Preview Mode / runtime, the same request fails with:
    “Invalid API key” (401 error)

I inspected the request using Chrome DevTools and confirmed:

  • The request reaches Supabase successfully

  • The runtime request appears to fail authentication only

  • The issue happens only inside Preview/runtime, not in External Collection testing

Current setup:

  • Supabase REST API

  • Using anon API key

  • Headers configured in External Collections

  • Postman and curl testing and external requests work correctly

Things I already checked:

  • API key validity

  • Authorization header formatting

  • Endpoint URL correctness

  • Supabase project settings

  • CORS configuration

Questions:

  • Does Adalo handle headers differently between test mode and runtime?

  • Is there a known issue where apikey or Authorization headers are stripped/modified in Preview Mode?

  • Do both headers need to be explicitly included?

Example headers:

apikey: <SUPABASE_ANON_KEY>
Authorization: Bearer <SUPABASE_ANON_KEY>

Would appreciate any guidance or workarounds others have found.

Hi @Luke,

It’s difficult to debug such things remotely, some notes:

  • I’ve used both Authorization: Bearer XXXXX and apikey: XXXXX headers in my settings
  • Never heard about Adalo stripping anything
  • Testing connection and using External collections’ in the app work differently. When you test the connection, it is done via a certain endpoint (https://backend.adalo.com/test-api-endpoint). But actual app (be it a preview or a published app) works through a different server (not from your app but Adalo one).

I would have looked at RLS (disabling it completely) but it is unlikely it causes an issue.

Best,
Victor.

I can say the endpoint or apikey works well in real app (built app).

But not working in preview mode or share link mode.

What’s wrong?

@Luke could you please confirm:

  • the test connection in External collections work fine, and
  • when you create a native app build in Adalo (Android or iOS), it works fine,
  • but when you run a preview from the Adalo builder, it doesn’t work, and
  • when you open the PWA (published one), it doesn’t work as well?

That’s quite a strange case, and given my knowledge on how Adalo External collections work, I can’t imagine such case (queries to External Collections come through Adalo server anyway, both from PWA and native builds).

As I have mentioned, it is quite difficult do debug such issues remotely, given 0 screenshots, logs, and screen recordings. Even with this info, some hands-on tests are needed. Therefore I would advice to submit a support ticket New Bug Form so that Adalo Support can have a look directly at your app.

Best,
Victor.