Seeing duplicate requests to Flask endpoint

William Lam 1 Reputation point
2020-09-05T13:22:35.667+00:00

I'm got a basic Custom Command defined which calls into a specific web endpoint (GET) which uses ngrok. Everything works as expected, but I'm seeing the Python Flask route get called twice for this specific command. The result is an error because this operation can only be called once given its input and I've not been able to debug why this is occurring

Here's the high level Flask app in case someone spots an issue and the createmg is the route in question which is getting called twice from the Cognitive Service

import json
from flask import Flask, request, Response, jsonify
import datetime
import time
import configparser

app = Flask(__name__)

@app.route('/createmg')
def createmg():
    payload = {
        "message": "1st function ran"
    }

    return Response(json.dumps(payload), mimetype='application/json')

@app.route('/migratemg')
def migratemg():
    payload = {
        "message": "2nd function ran"
    }

    return Response(json.dumps(payload), mimetype='application/json')

# run the app
if __name__ == '__main__':
    app.run(debug=False, use_reloader=False)

I've also tested manually bu performing cURL requests to endpoint locally and its only executed once, so something about the Custom Command seems to invoke this operation twice from what I can see

Azure AI services
Azure AI services
A group of Azure services, SDKs, and APIs designed to make apps more intelligent, engaging, and discoverable.
2,583 questions
{count} votes