Closed mbrat2005 closed 5 years ago
@maiqbal11 can you please investigate this?
Will do!
Hi @mbrat2005, could you provide your function.json as well as the code you are using for the timer trigger? Thanks!
Hi @maiqbal11,
I'm not modifying the function.json or init.py files at all from what is created by 'func new' with a Timer trigger.
Here is function.json: { "scriptFile": "init.py", "bindings": [ { "name": "mytimer", "type": "timerTrigger", "direction": "in", "schedule": "0 /5 *" } ] }
and init.py: import datetime import logging
import azure.functions as func
def main(mytimer: func.TimerRequest) -> None: utc_timestamp = datetime.datetime.utcnow().replace( tzinfo=datetime.timezone.utc).isoformat()
if mytimer.past_due: logging.info('The timer is past due!')
logging.info('Python timer trigger function ran at %s', utc_timestamp)
Below is a screenshot of the steps to reproduce: [image: image.png]
Thanks!
On Mon, Oct 29, 2018 at 4:06 PM Maheer Iqbal notifications@github.com wrote:
Hi @mbrat2005 https://github.com/mbrat2005, could you provide your function.json as well as the code you are using for the timer trigger? Thanks!
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Azure/azure-functions-python-worker/issues/224#issuecomment-434113457, or mute the thread https://github.com/notifications/unsubscribe-auth/AYNvWKMDQ34IsHAhnWPlSiYShHi0YRFEks5up4oLgaJpZM4XdJCZ .
HI @mbrat2005, sorry for the delay in getting to this. This is definitely some bug on our end. To put into concrete terms what the issue is, the {AzureWebJobsStorage} connection string entry in the local.settings.json
is somehow mismatched in its format:
{
"IsEncrypted": false,
"Values": {
"FUNCTIONS_WORKER_RUNTIME": "python",
"AzureWebJobsStorage": "{AzureWebJobsStorage}"
}
}
When I specify an actual connection string with the correct format, I am able to see the timer trigger running correctly without needing a manual trigger. The correct format needs to specify "name=value" semi-colon separated pairs that combine to form a valid connection string. Obviously, you shouldn't have to specify a connection string just to run a timer trigger. I'll dig some more into this and post here with updates.
Update
Synced with @ahmelsayed on this. For all triggers except for HTTP, a valid AzureWebJobsStorage connection string is required. The reason behind this has to do with scaling out to multiple VMs: If the function scales out to multiple VMs and has multiple instances, a storage account is needed to coordinate to ensure that only one instance of the timer trigger is running at a time. This poses some difficulty if you are trying to develop locally but, unfortunately, this is currently a limitation of the timer trigger.
Closing as this is currently part of the WebJobs SDK design. Please feel free to re-open/comment if you have concerns.
@maiqbal11 The func new
timer template currently sets the function up incorrectly, because it is setting the AzureWebJobsStorage
key to {AzureWebJobsStorage}
.
How do we dynamically set this value? I am assuming the official guidance is not to commit the secret...
Investigative information
Please provide the following:
Repro steps
Provide the steps required to reproduce the problem:
Expected behavior
Function host initializes and starts a listener for new timer trigger function, which can be manually triggered at http://localhost:7071/admin/functions/scom_alerting_verifier
Actual behavior
Function listener for function with timer trigger fails to start with 'Microsoft.WindowsAzure.Storage: Settings must be of the form "name=value"', then appears to start after a retry, but does not appear to be executed after a manual trigger URL for debugging. Functions with other trigger types start correctly.
[10/15/2018 20:44:40] Initializing Host. [10/15/2018 20:44:40] Host initialization: ConsecutiveErrors=0, StartupCount=1 [10/15/2018 20:44:40] Starting JobHost [10/15/2018 20:44:40] Starting Host (HostId=, InstanceId=1eb861f2-397e-4b32-b2c7-0527bb8c4e0f, Version=2.0.12115.0, ProcessId=20944, AppDomainId=1, Debug=False, FunctionsExtensionVersion=)
[10/15/2018 20:44:40] Starting language worker process:python "C:\Users\\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\workers\python\worker.py" --host 127.0.0.1 --port 59036 --workerId 8a9ee8f1-f0da-416d-b337-e436e2c829ec --requestId 63747daf-3427-451c-ab5b-01c69bcdcd11 --grpcMaxMessageLength 134217728
[10/15/2018 20:44:40] python process with Id=460 started
[10/15/2018 20:44:40] Generating 2 job function(s)
[10/15/2018 20:44:40] Found the following functions:
[10/15/2018 20:44:40] Host.Functions.scom_alert_verifier
[10/15/2018 20:44:40] Host.Functions.scom_subscriber_queue
[10/15/2018 20:44:40]
[10/15/2018 20:44:40] Host initialized (316ms)
[10/15/2018 20:44:40] The listener for function 'Functions.scom_alert_verifier' was unable to start.
[10/15/2018 20:44:40] The listener for function 'Functions.scom_alert_verifier' was unable to start. Microsoft.WindowsAzure.Storage: Settings must be of the form "name=value".
[10/15/2018 20:44:40] Host started (395ms)
[10/15/2018 20:44:40] Job host started
Hosting environment: Production
Content root path: C:\Users\\AzureFunctions\scom_alerting_test_proj
Now listening on: http://0.0.0.0:7071
Application started. Press Ctrl+C to shut down.
Listening on http://0.0.0.0:7071/
Hit CTRL-C to exit...
launch.json for VSCode configured.
[10/15/2018 20:44:41] starting timer function
[10/15/2018 20:44:41] starting timer function
[10/15/2018 20:44:42] Retrying to start listener for function 'Functions.scom_alert_verifier' (Attempt 1)
[10/15/2018 20:44:42] Listener successfully started for function 'Functions.scom_alert_verifier' after 1 retries.
Known workarounds
Related information
Provide any related information https://github.com/Azure/azure-functions-python-worker/wiki/Create-your-first-Python-function Environment: Windows 10 180928-1410 Node 10.12.0 Python 3.6.4 Azure Function Tools 2.0.3 .NET Core 2.1.403