I have never use Google Cloud before and this is all pretty new to me but Im trying to set it up anyway. Basically I would like my flow like this:
App -> gcp function -> hits Vm with my postgres db -> return data
Currently:
<code> - I CAN hit my function and get a response ('hello world)
- and I CAN SSH into the VM and get results from my db
- but I CANT seem to hit my VM from my gsp function
</code>
<code> - I CAN hit my function and get a response ('hello world)
- and I CAN SSH into the VM and get results from my db
- but I CANT seem to hit my VM from my gsp function
</code>
- I CAN hit my function and get a response ('hello world)
- and I CAN SSH into the VM and get results from my db
- but I CANT seem to hit my VM from my gsp function
I walked through this and I think I have it all correct but Im missing something:
https://cloud.google.com/functions/docs/networking/connecting-vpc
<code>- I created my VPC network (added firewall to allow port 80 and 5432)
- MY VM is connected to this VPC
- I created Serverless VPC access and set network to the one above
- I created a gcp function to test the connection but it keeps timing out
</code>
<code>- I created my VPC network (added firewall to allow port 80 and 5432)
- MY VM is connected to this VPC
- I created Serverless VPC access and set network to the one above
- I created a gcp function to test the connection but it keeps timing out
</code>
- I created my VPC network (added firewall to allow port 80 and 5432)
- MY VM is connected to this VPC
- I created Serverless VPC access and set network to the one above
- I created a gcp function to test the connection but it keeps timing out
Here is my function:
<code>const axios = require('axios');
exports.testVpcConnector = async (req, res) => {
try {
const response = await axios.get('http://{ VM_INTERNAL_IP_ADDRESS }');
console.log('RESPONSE-----------------', response)
// res.send(response.data);
} catch (error) {
console.log('ERROR-----------------', error)
// res.send(`Error: ${error.message}`);
}
};
</code>
<code>const axios = require('axios');
exports.testVpcConnector = async (req, res) => {
try {
const response = await axios.get('http://{ VM_INTERNAL_IP_ADDRESS }');
console.log('RESPONSE-----------------', response)
// res.send(response.data);
} catch (error) {
console.log('ERROR-----------------', error)
// res.send(`Error: ${error.message}`);
}
};
</code>
const axios = require('axios');
exports.testVpcConnector = async (req, res) => {
try {
const response = await axios.get('http://{ VM_INTERNAL_IP_ADDRESS }');
console.log('RESPONSE-----------------', response)
// res.send(response.data);
} catch (error) {
console.log('ERROR-----------------', error)
// res.send(`Error: ${error.message}`);
}
};
I added axios to the package.json.
Im not really sure what to do next. When I run Test Function
it just keeps timing out.