-4

I have a flask-app deployed on appengine which has to trigger Dag on my localhost. I am having trouble accessing the localhost url from appengine. It works when deployed locally so don't think there is anything wrong with the code, but when I make the same call with the appengine end point, it gives me the error of url not found. So far things I have tried: setting the host to "0.0.0.0" and "127.0.01". Here is the route I am calling:

@app.route('/run', methods=['POST'])
def trigger_dag():
    dag_status = requests.post('http://127.0.0.1:8080/api/v1/dags/ETL_JOB_V1/dagRuns',
                               auth=('admin', 'airflow'),
                               headers={"Content-Type": "application/json"},
                               json={}
                               )

    return dag_status.content

I am pretty new at this, but I think the issue is I am uable to tell appengine that for this call it has to go to my localhost to fetch.

Are there any other parameters or any gcloud libs I have to call here to make this work? Any help would be appreciated, as I have been stuck with this for quiet some time :)

1 Answers1

2

In simple terms, your localhost is not available to the world (aka internet). You're only able to access it from your local network.

To make your local host accessible via the web, you need an App that creates a tunnel (connection) between your localhost and the web. An example would be ngrok. See this stackoverflow answer for other examples

NoCommandLine
  • 5,044
  • 2
  • 4
  • 15