Skip to content

armresourcehealth v1.4.0 fails to unmarhsal armresourcehealth.Events due to type mismatch #27162

Description

@nimdanitro

Bug Report

  • import path of package in question: github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcehealth/armresourcehealth

  • SDK version: v1.4.0

  • output of go version: go1.26.5

  • What happened?
    We are consistently observing this unmarshalling error since upgrading from v1.3.0 to v1.4.0

unmarshalling type *armresourcehealth.Events: unmarshalling type *armresourcehealth.Events: struct field Value: unmarshalling type *armresourcehealth.Event: struct field Properties: unmarshalling type *armresourcehealth.EventProperties: struct field NewRate: json: cannot unmarshal string into Go value of type float64

Downgrading to v1.3.0 fixes the issue.

  • What did you expect or want to happen?
    Events are properly unmarshalled as before

  • How can we reproduce it?

package main

import (
	"context"
	"log/slog"
	"time"

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

func main() {
	subscriptionID := "..." // FIXME: replace with subscription ID
	ctx := context.Background()
	defaultCreds, err := azidentity.NewDefaultAzureCredential(&azidentity.DefaultAzureCredentialOptions{})
	if err != nil {
		slog.Error("failed to create defaultCreds", "error", err)
	}
	client, err := armresourcehealth.NewClientFactory(subscriptionID, defaultCreds, nil)
	if err != nil {
		slog.Error("failed to create armresourcehealth clientFactory", "error", err)
	}

	pager := client.NewEventsClient().NewListBySubscriptionIDPager(
		&armresourcehealth.EventsClientListBySubscriptionIDOptions{
			QueryStartTime: to.Ptr(time.Now().AddDate(0, 0, -30).Format("01/02/2006")),
		},
	)

	for pager.More() {
		_, err := pager.NextPage(ctx)
		if err != nil {
			slog.Error("failed to page resourcehealth events: ", "error", err)
		}
	}
}
			

The above code works with v1.3.0 and fails with v1.4.0 of github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcehealth/armresourcehealth

  • Anything we should know about your environment.
    Nothing special.

Metadata

Metadata

Assignees

Labels

MgmtThis issue is related to a management-plane library.Resource Healthcustomer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-author-feedbackWorkflow: More information is needed from author to address the issue.no-recent-activityThere has been no recent activity on this issue.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions