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.