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

Fix for ISO string modification during function metadata binding parsing #10735

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from

Conversation

satvu
Copy link
Member

@satvu satvu commented Jan 10, 2025

Issue describing the changes in this PR

resolves #10732 (and Azure/azure-functions-dotnet-worker#2882)

Pull request checklist

IMPORTANT: Currently, changes must be backported to the in-proc branch to be included in Core Tools and non-Flex deployments.

  • Backporting to the in-proc branch is not required
    • Otherwise: Link to backporting PR
  • My changes do not require documentation changes
    • Otherwise: Documentation issue linked to PR
  • My changes should not be added to the release notes for the next release
    • Otherwise: I've added my notes to release_notes.md
  • My changes do not need to be backported to a previous version
    • [] Otherwise: Backport tracked by issue/PR #issue_or_pr
  • My changes do not require diagnostic events changes
    • Otherwise: I have added/updated all related diagnostic events and their documentation (Documentation issue linked to PR)
  • I have added all required tests (Unit tests, E2E tests)

Additional information

Tested locally E2E the following scenarios:

  1. StartFromTime set to a past time started triggering and processing existing records immediately after startup (older records than start time untouched)
  2. StartFromTime set to a future date and will process any new changes following startup. Discussed with original engineers - this feature was only meant to go into the past, so there was never a design set for future dates. This setting will not ignore changes until that future date (note: need to test InProc to see if behavior is the same there).

@satvu satvu marked this pull request as ready for review January 11, 2025 00:29
@satvu satvu requested a review from a team as a code owner January 11, 2025 00:29
@@ -244,13 +247,26 @@ internal IEnumerable<FunctionMetadata> ValidateMetadata(IEnumerable<RawFunctionM
return validatedMetadata;
}

private static BindingMetadata GetBindingMetadata(string binding)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be CreateBindingMetadata ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can the private method be underneath the internal methods?

using (StringReader stringReader = new StringReader(binding))
using (JsonTextReader jsonTextReader = new JsonTextReader(stringReader))
{
JsonSerializer serializer = JsonSerializer.Create(_jsonSerializerSettings);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we DI the JsonSerializer so we're not creating one every time this method is called?

@@ -28,6 +30,7 @@ internal class WorkerFunctionMetadataProvider : IWorkerFunctionMetadataProvider
private readonly IScriptHostManager _scriptHostManager;
private string _workerRuntime;
private ImmutableArray<FunctionMetadata> _functions;
private static JsonSerializerSettings _jsonSerializerSettings = new JsonSerializerSettings { DateParseHandling = DateParseHandling.None };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we setup the serializer + settings as part of the ctor?

@@ -10,3 +10,4 @@
- [Added net9 prelaunch app.](https://github.com/Azure/azure-functions-dotnet-worker/pull/2898)
- Update the `DefaultHttpProxyService` to better handle client disconnect scenarios (#10688)
- Replaced `InvalidOperationException` with `HttpForwardingException` when there is a ForwarderError
- Fix the accidental modification of ISO strings during function metadata binding parsing. This fixes the listener errors related to the CosmosDB trigger's `StartFromTime` parameter. (#10735)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Fix the accidental modification of ISO strings during function metadata binding parsing. This fixes the listener errors related to the CosmosDB trigger's `StartFromTime` parameter. (#10735)
- Fix modification of ISO strings during the parsing of function metadata bindings.
- This fixes the listener errors related to the CosmosDB trigger's `StartFromTime` parameter. (#10735)

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

Successfully merging this pull request may close these issues.

Parsing bindings into a JObject modifies strings in ISO format
2 participants