azure-functions-core-tools icon indicating copy to clipboard operation
azure-functions-core-tools copied to clipboard

Can't create "EventGrid trigger" template forPython: Sequence contains no matching element

Open CoolSpot opened this issue 1 year ago • 2 comments

Version

$ func --version
4.0.5907

Description

  1. First issue is that "func templates -l python list" gives invalid names for some templates, for example "Azue Event Grid trigger" can't be used as a template name for "func new" (see #2955)

  2. Even when using correct name "EventGrid trigger" it gives error "Sequence contains no matching element"

$ func new --verbose --name SomeAction --template "EventGrid trigger"
Sequence contains no matching element

$ func new --verbose --name SomeAction
Select a number for template:
1. Blob trigger
2. CosmosDB trigger
3. Dapr Publish Output Binding
4. Dapr Service Invocation Trigger
5. Dapr Topic Trigger
6. EventGrid trigger
7. EventHub trigger
8. HTTP trigger
9. Queue trigger
10. ServiceBus Queue trigger
11. ServiceBus Topic trigger
12. Timer Trigger
Choose option: 6
Sequence contains no matching element

Steps to reproduce

  1. create fresh python function app project func init --python

  2. try to create from an EventGrid trigger template: func new --verbose --name SomeAction or func new --verbose --name SomeAction --template "EventGrid trigger"

  3. Observe error "Sequence contains no matching element"

  4. renaming existing file function_app.py to _function_app.py makes it work - it will create a directory SomeAction with files init.py and function.json

CoolSpot avatar Sep 07 '24 04:09 CoolSpot

Any updates on this issue. I have the exact same problem

$ func --version
4.0.6280

ashkan-inpex avatar Sep 16 '24 05:09 ashkan-inpex

same issue.

func --version
4.0.6280

oanabotezat avatar Oct 25 '24 12:10 oanabotezat

This seems to be working today?

> func -v
4.1.0

> func new --verbose --name SomeAction --template "EventGrid trigger"

Appending to <path>/pythonapp/function_app.py
The function "SomeAction" was created successfully from the "EventGrid trigger" template.

But if you delete function_app.py, and create again, it will fail:

> func new --verbose --name SomeAction --template "EventGrid trigger"
Select a number for template:EventGrid trigger
Can't find template "EventGrid trigger" in "Python"

So it seems like the templates require a function_app.py to exist for them to work:

import azure.functions as func
import datetime
import json
import logging

app = func.FunctionApp()

But I do not see the original issue mentioned "Sequence contains no matching element" - is anyone still able to repro this with 4.1.0? If so, can you share a repro?

liliankasem avatar Aug 04 '25 23:08 liliankasem

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

If you are not the original author (@CoolSpot) and believe this issue is not stale, please comment with /bot not-stale and I will not close it.