graphql-engine: Actions don't work on Cloud Functions
Trying to have a custom mutation run on my Cloud Function which is served locally on http://localhost:5000/xxxx-52a3e/us-central1/auth-signUp
However, for some reason (I suspect because it’s being called via http, not https), I am getting this error:
{
"errors": [
{
"extensions": {
"internal": {
"type": "http_exception",
"message": "ConnectionFailure Network.Socket.connect: <socket: 36>: does not exist (Connection refused)"
},
"path": "$",
"code": "unexpected"
},
"message": "http exception when calling webhook"
}
]
}
For reference here is the sample function:
import { https } from 'firebase-functions'
const signUp = https.onRequest((req, res) => {
console.log(req, res)
})
export { signUp }
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 16 (1 by maintainers)
You don’t need to change the
docker-compose.ymlfile.If you are on Docker for Mac/Windows 18.03+, change the action URL to
http://host.docker.internal:5000/xxxx-52a3e/us-central1/auth-signUp.Or, serve up your cloud function with command
firebase serve --host 0.0.0.0, so hasura can access it viahttp://172.17.0.1:5000/xxxx-52a3e/us-central1/auth-signUp. 172.17.0.1 is the docker0’s IPfor anyone stumbling up on this issue - our issue is the same as above but for deeper context, existed in github-actions where we’re treating it as a CI with a fresh hasura instance being spun up and migrated via
docker-composeand a locally built/compiled nextjs application running locally onlocalhost:3000(this is so we can run a full integration test (cypress) against it)…only hasura actions wouldn’t work because as of right now linux docker does not understandhost.docker.internal…The fix is a bit of a hack but works until a PR for linux docker and docker-compose to treat
host.docker.internalthe same as it does on mac and windows.we ran ifconfig on the ci to get the address docker is running on and added it to extra hosts - like so
Sorry didn’t ask for your dev environment at first. I was assuming your next.js app running on your local machine, hasura & postgres running inside docker.
docker.host.internalgives you access to docker host’s local network.If your next.js is the
appservice in the docker-compose file, hasura access it usinghttp://app:3000/blah_blah_blah. Docker can resolve it automatically within its network by service name within the same network.Can you deploy the function to glitch.com, and test the hasura’s action is working fine with a connection to a live URL. Just to make sure there’s no problem with hasura rather a network-config problem with docker.