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

The API NewEmergingIssuesClient.NewListPager() throws unmarshalling error #22272

Closed
ParthaI opened this issue Jan 18, 2024 · 9 comments · Fixed by #22354
Closed

The API NewEmergingIssuesClient.NewListPager() throws unmarshalling error #22272

ParthaI opened this issue Jan 18, 2024 · 9 comments · Fixed by #22354
Labels
ARM customer-reported Issues that are reported by GitHub users external to the Azure organization. Mgmt This issue is related to a management-plane library. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team Resource Health Service Attention Workflow: This issue is responsible by Azure service team.

Comments

@ParthaI
Copy link

ParthaI commented Jan 18, 2024

Bug Report

  • import path of package with versiin :
    • github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcehealth/armresourcehealth v1.3.0
    • github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0
  • output of go version
    • go version go1.21.4 darwin/arm64
  • I was trying to list the Resource Heath Emerging Issue for my tenant, some how the SDK is throwing the following error
    • 2024/01/18 19:54:06 failed to advance page: unmarshalling type *armresourcehealth.EmergingIssueListResult: unmarshalling type *armresourcehealth.EmergingIssueListResult: struct field Value: unmarshalling type *armresourcehealth.EmergingIssuesGetResult: struct field Properties: unmarshalling type *armresourcehealth.EmergingIssue: struct field RefreshTimestamp: parsing time "\"2024-01-18 14:18:54Z\"" as "\"2006-01-02T15:04:05.999999999Z07:00\"": cannot parse " 14:18:54Z\"" as "T"
    • The SDK is not able to parse the value 2024/01/18 19:54:06 to time stamp.
    • However, I am able to get the result from API explorer
  • What should you Expect?
  • The API EmergingIssuesClient.NewListPager should return the result instead of error
  • How can we reproduce it?
    • Just make the API call EmergingIssuesClient.NewListPageras follows
package main

import (
   "context"
   "fmt"
   "log"

   "github.com/Azure/azure-sdk-for-go/sdk/azidentity"
   "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcehealth/armresourcehealth"
)

// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b74978708bb95475562412d4654c00fbcedd9f89/specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/stable/2022-10-01/examples/EmergingIssues_List.json
func main() {
   cred, err := azidentity.NewDefaultAzureCredential(nil)
   if err != nil {
   	log.Fatalf("failed to obtain a credential: %v", err)
   }
   ctx := context.Background()
   clientFactory, err := armresourcehealth.NewClientFactory("", cred, nil)
   if err != nil {
   	log.Fatalf("failed to create client: %v", err)
   }

   pager := clientFactory.NewEmergingIssuesClient().NewListPager(nil)
   for pager.More() {
   	page, err := pager.NextPage(ctx)
   	if err != nil {
   		log.Fatalf("failed to advance page: %v", err)
   	}
   	for _, v := range page.Value {
   		// You could use page here. We use blank identifier for just demo purposes.
   		fmt.Printf("Name : %s", *v.Name)
   	}

   	if page.NextLink == nil {
   		break

   	}

   }
}
  • Anything we should know about your environment.
    • N/A
@github-actions github-actions bot added ARM customer-reported Issues that are reported by GitHub users external to the Azure organization. Mgmt This issue is related to a management-plane library. needs-team-triage Workflow: This issue needs the team to triage. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Jan 18, 2024
@jhendrixMSFT jhendrixMSFT added Resource Health Service Attention Workflow: This issue is responsible by Azure service team. and removed question The issue doesn't require a change to the product in order to be resolved. Most issues start as that needs-team-triage Workflow: This issue needs the team to triage. labels Jan 18, 2024
Copy link

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @stephbaron.

@github-actions github-actions bot added the needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team label Jan 18, 2024
@jhendrixMSFT
Copy link
Member

It appears that the service is returning the date-time in the wrong format.

Copy link

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @armleads-azure @stephbaron.

@bigdatasourav
Copy link

Hey @jhendrixMSFT, is there any update on this one?

@jhendrixMSFT
Copy link
Member

Somebody from the service team will have to comment on why the service returns the time in an invalid format. @stephbaron are you the correct person?

@lirenhe
Copy link
Member

lirenhe commented Jan 30, 2024

@jhendrixMSFT, is it possible for our SDK to be more robust for different format of the datetime? https://ijmacd.github.io/rfc3339-iso8601/

@jhendrixMSFT
Copy link
Member

We can, but the question is, should we? This is the first time I've ever seen a service send time in this format. Do the other languages handle it?

@JeffreyRichter the time is coming back as 2024-01-18 14:18:54Z. Note the missing T between the date and time. While it's easy enough to handle, and for compat reasons we might have to, should services be using this format?

@JeffreyRichter
Copy link
Member

Ugh. Azure should be using RFC3339 dates/times which requires a T or t. https://datatracker.ietf.org/doc/html/rfc3339.

But there is a note at the bottom of page 8 that says this about the more lenient iso 8601:

  NOTE: ISO 8601 defines date and time separated by "T".
  Applications using this syntax may choose, for the sake of
  readability, to specify a full-date and full-time separated by
  (say) a space character.

So, I think our SDK should support parsing space for older azure services where forcing them to add the t now may break customers.

@jhendrixMSFT
Copy link
Member

The fix will be in v1.4.0-beta.2 released later today.

@github-actions github-actions bot locked and limited conversation to collaborators May 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
ARM customer-reported Issues that are reported by GitHub users external to the Azure organization. Mgmt This issue is related to a management-plane library. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team Resource Health Service Attention Workflow: This issue is responsible by Azure service team.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants