Hi dude,
The problem is due to when making request for checking supabase credential, n8n added both “apiKey” and “Auhorization” to the Header (you can refer to their code here: n8n/packages/nodes-base/credentials/SupabaseApi.credentials.ts at master · n8n-io/n8n · GitHub)
Combining with the info from supabase API docs menu, I found out that when having Authorization in header, supabase under-the-hood logic seems to omit the “apiKey” as it will be looking for the user of that Authorization (not the service role key which not belong to any user)
My solution is to add the plugin that remove authorization key in the kong.yml file (you can find it in ./your-project/volumes/api/kong.yml):
- name: request-transformer
config:
remove:
headers:
- Authorization
And making sure in docker-compose file the kong service can use the kong.yml file correctly:
kong:
container_name: supabase-kong
image: kong:2.8.1
restart: unless-stopped
networks:
- supabase_network
ports:
- "${KONG_HTTP_PORT}:8000"
- "${KONG_HTTPS_PORT}:8443"
volumes:
- ./volumes/api/kong.yml:/home/kong/temp.yml:ro,z
depends_on:
tailscale:
condition: service_healthy
analytics:
condition: service_healthy
environment:
KONG_DATABASE: "off"
KONG_DECLARATIVE_CONFIG: /home/kong/kong.yml
KONG_DNS_ORDER: LAST,A,CNAME
KONG_PLUGINS: request-transformer,cors,key-auth,acl,basic-auth
KONG_NGINX_PROXY_PROXY_BUFFER_SIZE: 160k
KONG_NGINX_PROXY_PROXY_BUFFERS: 64 160k
SUPABASE_ANON_KEY: ${ANON_KEY}
SUPABASE_SERVICE_KEY: ${SERVICE_ROLE_KEY}
DASHBOARD_USERNAME: ${DASHBOARD_USERNAME}
DASHBOARD_PASSWORD: ${DASHBOARD_PASSWORD}
entrypoint:
- bash
- -c
- |
sed -e "s/\$$SUPABASE_ANON_KEY/${ANON_KEY}/g" \
-e "s/\$$SUPABASE_SERVICE_KEY/${SERVICE_ROLE_KEY}/g" \
-e "s/\$$DASHBOARD_USERNAME/${DASHBOARD_USERNAME}/g" \
-e "s/\$$DASHBOARD_PASSWORD/${DASHBOARD_PASSWORD}/g" \
/home/kong/temp.yml > /home/kong/kong.yml
/docker-entrypoint.sh kong docker-start
Hope this can help!!

