laveeshb / azure-function-extensions-net

Extensions for Azure Functions
MIT License
4 stars 7 forks source link

Using this with another language like javascript/python #57

Open teebu opened 2 years ago

teebu commented 2 years ago

I added the nuget package, set the function.json and host.json.

index.js:

module.exports = async function (context, message) {
    context.log('started sqs')
    context.log(message);
};

function.json

{
  "bindings": [
    {
      "name": "message",
      "type": "sqsQueueTrigger",
      "direction": "in",
      "queueName": "sqs-test",
      "QueueUrl": "https://....amazonaws.com/xxx/sqs-test",
      "AWSKeyId": "...",
      "AWSAccessKey": "..."
    }
  ]
}

host.json:

{
  "version": "2.0",
  "extensions": {
    "sqsQueue": {
      "maxNumberOfMessages": 10,
      "pollingInterval": "00:00:15"
    }
  }
}

Error:

Invoked the queue trigger at '8/18/2022 9:10:59 PM UTC'. Fetched messages count: '1'.
[2022-08-18T21:10:59.567Z] Executing 'Functions.test-func' (Reason='(null)', Id=11785201-5643-472b-9f07-82ec9627a225)
[2022-08-18T21:10:59.568Z] Executed 'Functions.test-func' (Failed, Id=11785201-5643-472b-9f07-82ec9627a225, Duration=1ms)
[2022-08-18T21:10:59.569Z] System.Private.CoreLib: Exception while executing function: Functions.test-func. System.Private.CoreLib: Unable to cast object of type 'Amazon.SQS.Model.Message' to type 'System.String'.