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

Backward incompatability - CreateService - existing setup works in 1.3.0 but not in 1.4.x #346

Closed
onikroo opened this issue Aug 12, 2021 · 4 comments
Labels
Milestone

Comments

@onikroo
Copy link

onikroo commented Aug 12, 2021

Have an existing module used to create a service with 1.3.0, which now fails following update to 1.4.x

Steps to reproduce:

  1. Create API client using API token:
    client := pagerduty.NewClient(*currentModel.PagerDutyToken)

  2. Get escalation policy:
    escalationpolicy, err := client.GetEscalationPolicy(*currentModel.EscalationPolicyID, &pagerduty.GetEscalationPolicyOptions{})

  3. Populate service params:
    service := pagerduty.Service{ Name: *currentModel.Name, Description: *currentModel.Description, EscalationPolicy: *EscalationPolicy, }

  4. Create service:
    res, err := client.CreateService(service)

The error caught in 1.4.x is:
HTTP response failed with status code 400, message: Invalid Input Provided (code: 2001)

In 1.3.0 this creates successfully.

Have tested this with the same code and variables across both versions, and can confirm rolling back to 1.3.0 works as expected once again.

@theckman
Copy link
Collaborator

Apologies for this. I'll work on tracking this down over the next day or so.

@theckman theckman added this to the v1.4.2 milestone Aug 30, 2021
@theckman
Copy link
Collaborator

It looks like it's because of the new fields that got added to the Service type, SupportHours and ScheduledActions. I think adding omitempty to both should fix this.

@theckman theckman added the bug label Aug 30, 2021
theckman added a commit that referenced this issue Aug 30, 2021
The lack of `omitempty` on these fields is causing `CreateService` calls to fail
when both are omitted. This broke in the v1.4.0 release so this is a bug fix.

Relates to #348

Fixes #346
@theckman
Copy link
Collaborator

I'm prepping the v1.4.2 release now, and it should be available within the hour so I'll close this issue.

@theckman
Copy link
Collaborator

It's now available.

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

Successfully merging a pull request may close this issue.

2 participants