1

I have a http trigger function, when I sent a message to the url, it logs data on the queuestorage as required;

http://localhost:7071/api/xxxx?message=89000

However when I do the same in azure on the function url

https://yyyyy.azurewebsites.net/api/xxxx?message=89000 nothing is logged.

How can I have this resolved?

Another question; The underlying code is

import logging
import azure.functions as func
def main(req: func.HttpRequest,msg: func.Out[str]) -> func.HttpResponse:
    logging.info('Python HTTP trigger function processed a request.')
    input_msg = req.params.get('message')
    logging.info(input_msg)
    msg.set(input_msg)
    return func.HttpResponse(
            "This is a test.",
            status_code=200
    )

It is expected to receive the following payload

{
    "layerId":0,
    "serviceName": "myService",
    "changeType": "FeaturesCreated",
    "orgId": "myorgId"
    "changesUrl": "https://olserver/services/myService/FeatureService/extractChanges?serverGens=[1122, 1124]"
}

when I do http://localhost:7071/api/xxxx?message=89000, it logs the queue storage just fine but not when this payload is delivered. How can I have this configured?

wwnde
  • 26,119
  • 6
  • 18
  • 32

1 Answers1

1

Azure function app don't get environment variable from local.settings.json on portal.

You need to add below setting:

enter image description here

To

enter image description here

And in order to prevent the inability to save messages due to certain settings of the queue, you can try to create a new queue to avoid this situation.

Cindy Pau
  • 13,085
  • 1
  • 15
  • 27
  • On this one, if I wanted the app to log `message={ "layerId":0, "serviceName": "myService", "changeType": "FeaturesUpdated", "orgId": "myorgId" "changesUrl": "https://olserver/services/myService/FeatureService/extractChanges?serverGens=[1122, 1124]" }` instead of `message=20000` are there setting to tweak? – wwnde Nov 16 '20 at 03:40
  • @wwnde I didn't read the underlying code of queue binding, but it is likely to be string based. You may be able to write it to queue like a normal string, and then use some modules to convert it when reading. – Cindy Pau Nov 16 '20 at 03:46
  • @wwnde You can write normally without problem, but it should have no nested structure – Cindy Pau Nov 16 '20 at 03:48
  • see my edits. Is there away to configure the code to expect the payload? – wwnde Nov 16 '20 at 03:56
  • 1
    @wwnde I have something to do outside for the time being. I don't have a computer around me. I'll help you and do a test when I go back. – Cindy Pau Nov 16 '20 at 04:00
  • I can resolve this issue by logging a specific string every time the client http is triggered. How can I for instance change the code to ensure say a message 11111 is queued every time. I don't mind if that causes an overwrite. – wwnde Nov 16 '20 at 04:34
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/224612/discussion-between-wwnde-and-bowman-zhu). – wwnde Nov 16 '20 at 04:42