Error you are not authorized, self-hosting velo external database adapter and the database

Question:
I am trying to connect Wix with an external database that’s self-hosted on a Google VM (not google cloud SQL). Because I have a virtual machine, I am trying to run the velo-external-db adaptor using docker container in the same VM. I use the following command to spin up the velo-external-db container:

sudo docker run --name vconn -d -p 8080:8080 --env PORT=8080 --env TYPE=postgres \
--env CLOUD_VENDOR=aws --env USER=post_user --env PASSWORD='fakepass' \
--env DB=deliverydb --env HOST=<some_public_ip> \
--env PERMISSIONS='{  "collectionPermissions": [    {      "id": "test_table2", "read": ["Admin", "Member", "Visitor"], "write": ["Admin", "Member", "Visitor"]    }  ]}' \
--env SECRET_KEY=myBigSecret \
gcr.io/wix-velo-api/velo-external-db:postgres

On the service page I get the following status:

But when I try to test it from the terminal using the command:

curl -L -X POST 'http://example.domain.com:8080/schemas/list' -H 'Content-Type: application/json' --data-raw '{
  "requestContext": {
    "settings": {
      "secretKey": "myBigSecret"
    },
    "role": "OWNER"
  }
}'

I get the following error:

{"message":"You are not authorized"}

What are you trying to achieve:
Being able to connect Wix with external database/ collections so that I can store user data.

What have you already tried:
I followed this tutorial on Wix’s site: https://dev.wix.com/docs/develop-websites/articles/databases/external-databases/google/integrate-your-google-cloud-platform-databases-with-your-wix-site#test-your-service.
After not being able to setup he connection this way, I followed the tutorial using Cloud SQL and Cloud Run. This setup worked, but requires the use of code written specifically in the backend.

Additional information:
The VM is running Debian 12.

Is this error message coming from the Postgres instance or Wix? My guess is that running a custom Postgres instance doesn’t have the same authorization workflow as Postgres on GCP. So this is likely something that needs to be resolved in Postgres as according to Wix the connection itself is fine.

A further guess is that since the error message says authorization and not authentication then sending the secretKey succeeded but the role isn’t being recognized by the Postgres instance. I’m not sure what Postgres would expect in the request but that’s something to look at.

2 posts were split to a new topic: Do external database integrations work with the Wix UI?