External database velo adaptor gives error when testing the service

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 test -d -p 8080:8080 --env PORT=8080 \
--env TYPE=postgres --env CLOUD_VENDOR=azure --env USER=dsp_user \
--env PASSWORD=fakePass --env DB=deliverydb --env HOST=123.123.123.123 \
--env SECRETKEY=myBigSecret \
--env PERMISSIONS='{  "collectionPermissions": [    {      "id": "daily_summaries", "read": ["Admin", "Member"],      "write": ["Admin"]    }  ]}' \
velo_dp_adaptor

On the service page I get the following status:

On the terminal I have also tried to use curl to test the service. I used 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"
  }
}'

but got the error:

{"data":{"description":"Authorization failed: jwt must be a string"},"errorCode":"UNAUTHORIZED"}

What are you trying to achieve:
How can I fix these issues and successfully connect these services with Wix.

What have you already tried:
I’ve tried to seek help from some question like: External Database Configuration for Ubuntu - #10 by wayneatwood-com. But they don’t report the commands used to test the service and the output they get.

How is the JWT being passed? The errors seem to indicated that jwtPublicKey and appDefId are missing. Note I’m not too familiar with this.

I also edited the above post as it seems a password and IP are visible (hopefully it was a fake pass)

1 Like

Thanks for the edit to hide the real information, much appreciated.
The issue was that I used github’s latest commit on master branch to spin up the velo-external-db adaptor. This was made me use a version that was not intended to work as per the tutorial.

The Solution was to use a built image from gcr.io/wix-velo-api/velo-external-db. I didn’t realize that google also has docker registry. I thought only about docker hub’s registry and not having find any images there I assumed that if I want to run this image on my machine without using Google’s “Cloud Run” I would need to build it myself.

Solution TL;DR
Using velo-external-db image from gcr.io/wix-velo-api/velo-external-db fixes the issue by using the correct image.

1 Like