Open Rapol opened 4 years ago
Hey @Rapol, I'll see if I can look into this sometime this week. Could you try running without x-azure-settings
?
processEventHubLogs:
handler: src/eventHubHandler
events:
- eventHub:
name: fileMessages
path: EVENT_HUB_PATH
connection: EVENT_HUB_CONNECTION_STRING
cardinality: many
We just tried it again with and without x-azure-settings and it is adding the cardinality to the host.json in both cases. Not able to reproduce and we tried the same serverless config without any modifications. Closing this, thanks for the quick response.
Hello,
I got into the same issue with version 2.0.13. I was unable to add cardinality into function.json
We just migrated to 2.1.0 to be able to deploy node12 and v3 function runtime and stumbled again with this issue. We have our own fork and by adding the following to bindings.json (https://github.com/serverless/serverless-azure-functions/blob/master/src/shared/bindings.json#L60) the plugin set the cardinality correctly in the function.json
{
"type": "eventHubTrigger",
"displayName": "$eventHubTrigger_displayName",
"direction": "trigger",
"enabledInTryMode": false,
"documentation": "$content=Documentation\\eventHubTrigger.md",
"settings": [
/**** Add cardinality ****/
{
"name": "cardinality",
"value": "enum",
"required": false,
"defaultValue": "many",
"enum": [
{
"value": "one",
"display": "One"
},
{
"value": "many",
"display": "Many"
}
],
"label": "$eventHubTrigger_cardinality_label",
"help": "$eventHubTrigger_cardinality_help"
},
Whats the fix here guys? cardinality seems to be completely ignored in the servleress.yml; And although Azure suggests it should default to "many" its only receiving a single event (not an array).
TL;DR We set cardinality: many in Azure there's no config for cardinality after deployment it just disappears
We fixed it by adding the following item to the eventHubTrigger binding settings array
{
"name": "cardinality",
"value": "enum",
"required": false,
"defaultValue": "many",
"enum": [
{
"value": "one",
"display": "One"
},
{
"value": "many",
"display": "Many"
}
],
"label": "$eventHubTrigger_cardinality_label",
"help": "$eventHubTrigger_cardinality_help"
},
Add the previous object to this array https://github.com/serverless/serverless-azure-functions/blob/master/src/shared/bindings.json#L65
We have solved this with adding the object in bindings.json file as described by @Rapol, but instead of forking I created a patch using patch-package. However, this is still an issue that should be considered resolving in next version of the module, even more so because it is a simple fix in bindings.json.
Unfortunately, azure seems to have abandoned this project. The community might need to fork it to fix bugs and add new features.
Function app has been adding features to hook them up with apim, cdn, authorization, etc somewhat easily so my guess is they want to move to ARM/terraform and not maintain sls framework.
This is a Bug Report
Description
Deploying an event hub trigger doesn't set the cardinality in 2.0.9. This worked at least on 1.0.2-16 which we were using before upgrading to 2.x.x.
sls deploy should generate the correct host.json for event hub trigger and include the cardinality
Additional Data
We found that in the default bindings (bindings.json), the binding of type eventhubTrigger cardinality setting was removed in 2.0.0. This setting needs to be added back