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

Json deserialization error on resources.redirectStart property #35

Open
Warren-CabEngine opened this issue Sep 20, 2024 · 0 comments · Fixed by #49
Open

Json deserialization error on resources.redirectStart property #35

Warren-CabEngine opened this issue Sep 20, 2024 · 0 comments · Fixed by #49
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@Warren-CabEngine
Copy link

Which Umbraco.Community.Sustainability version are you using?

1.0.4

Which Umbraco version are you using? For example: 10.8.0 - don't just write v10

13.5.1

Bug summary

This is my first time installing and running this package. Clicking "Run sustainability report" fails with this error:

image

The issue appears to be with this field: https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming/redirectStart. Within this package it tries to deserialize the value to an int from looking at the SustainabilityData model class, but the Mozilla docs state that this field is a timestamp which is a double.

Steps to reproduce

  • Install Sustainability Package
  • Select a page in the back office
  • Run sustainability report against the page
An error occurred

The JSON value could not be converted to System.Int32. Path: $.resources[7].redirectStart | LineNumber: 0 | BytePositionInLine: 5673.
Exception Details
System.Text.Json.JsonException, System.Text.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51: The JSON value could not be converted to System.Int32. Path: $.resources[7].redirectStart | LineNumber: 0 | BytePositionInLine: 5673. 

at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, Utf8JsonReader& reader, Exception ex)
at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan`1 utf8Json, JsonTypeInfo`1 jsonTypeInfo, Nullable`1 actualByteCount)
at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan`1 json, JsonTypeInfo`1 jsonTypeInfo)
at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, JsonSerializerOptions options)
at Umbraco.Community.Sustainability.Services.SustainabilityService.GetSustainabilityData(String url)
at Umbraco.Community.Sustainability.Services.SustainabilityService.GetSustainabilityData(String url)
at Umbraco.Community.Sustainability.Controllers.SustainabilityController.CheckPage(Guid pageKey)

Expected result / actual result

Should successfully generate a report, but instead it errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants