Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CosmosDBTrigger does not accept any valid StartFromTime value #2882

Open
lostincomputer opened this issue Nov 28, 2024 · 4 comments
Open

CosmosDBTrigger does not accept any valid StartFromTime value #2882

lostincomputer opened this issue Nov 28, 2024 · 4 comments
Assignees

Comments

@lostincomputer
Copy link

lostincomputer commented Nov 28, 2024

Description

CosmosDBTrigger does not accept any valid StartFromTime value and always fails with:

The listener for function 'Functions.Function1' was unable to start. Microsoft.Azure.WebJobs.Extensions.CosmosDB: The specified StartFromTime parameter is not in the correct format. Please use the ISO 8601 format with the UTC designator. For example: '2021-02-16T14:19:29Z'.

The exact same setup works in in-process model with Microsoft.Azure.WebJobs.Extensions.CosmosDB, but not in isolated worker model with Microsoft.Azure.Functions.Worker.Extensions.CosmosDB.

Steps to reproduce

Create an Isolated worker Azure function and reference Microsoft.Azure.Functions.Worker.Extensions.CosmosDB

[Function("Function1")]
public void Run([CosmosDBTrigger(
    databaseName: "databaseName",
    containerName: "containerName",
    Connection = "CosmosDbConnectionString",
    LeaseContainerName = "LeaseContainerName ",
    CreateLeaseContainerIfNotExists = true,
    StartFromTime = "2021-02-16T14:19:29Z" // Error is thrown even when I use the example value in the error message
    )] IReadOnlyList<Transaction> transactions)
{
}
@lostincomputer lostincomputer added the potential-bug Items opened using the bug report template, not yet triaged and confirmed as a bug label Nov 28, 2024
@satvu
Copy link
Member

satvu commented Jan 6, 2025

Can you share which version you are using of the following:

  • CosmosDB extension
  • Worker
  • Core-tools

Is this error reproducing locally or in production? I am unable to reproduce this error locally with the information you've provided - could you share a link to a GH repo of a minimal function app repro? Thanks!

@lostincomputer
Copy link
Author

I'm reproducing the error locally. Here is a GH repo that reproduces the problem

CosmosDB extension version- 4.11.0
Worker version- 2.0.0
Core-tools version- 4.0.6610
Function Runtime version: 4.1036.1.23224

The bug might have something to do with the Window's region format setting. If my region format is "English (United States)", I get this error:

Image

But if my region format is "English (New Zealand)", I get this:

Image

This is the region format setting that I was talking about:

Image

@satvu
Copy link
Member

satvu commented Jan 7, 2025

Thanks! Great find with the region format setting. I am able to repro locally - this thread will be updated as we continue investigating.

@satvu satvu self-assigned this Jan 8, 2025
@satvu satvu added bug Something isn't working and removed potential-bug Items opened using the bug report template, not yet triaged and confirmed as a bug labels Jan 8, 2025
@satvu
Copy link
Member

satvu commented Jan 9, 2025

This is actually a host bug - in this line, the binding and properties are parsed using Newtonsoft.JSON, which has this known bug regarding ISO strings.

It is altering the string based on the local time settings, resulting in the errors above. Tracking the fix in the host at this issue: Azure/azure-functions-host#10732.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants