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

[Notification Hubs] Unable to remove APNS|GCM|... credentials from a Notification Hub #2246

Closed
tombuildsstuff opened this issue Jul 18, 2018 · 5 comments
Assignees
Labels
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-author-feedback Workflow: More information is needed from author to address the issue. no-recent-activity There has been no recent activity on this issue. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that

Comments

@tombuildsstuff
Copy link
Contributor

Bug Report

  • import path of package in question: github.com/Azure/azure-sdk-for-go/services/notificationhubs/mgmt/2017-04-01/notificationhubs
  • SDK version: v18.0.0
  • output of go version: go version go1.10.2 darwin/amd64

👋 me again!

So I've been looking into Notification Hubs and have found a bug in the SDK;

Looking to the Portal, it's possible to add APNS/GCM Credentials for a given Notification Hub using the following (redacted) request:

{
	"location": "westeurope",
	"properties": {
		"apnsCredential": {
			"properties": {
				"endpoint": "https://api.development.push.apple.com:443/3/device",
				"keyId": "XXXXXXXXXXXX",
				"appName": "uk.co.toms.app",
				"appId": "XXXXXXXXXXXX",
				"token": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..."
			}
		}
	}
}

which works as expected using the CreateOrUpdate method of the notificationhubs SDK (2017-04-01/v18.0.0). It's also possible to successfully retrieve these credentials using the `` method/endpoint which is :thumbs_up: so far.

The issue comes with removing these credentials - in the Portal this is done by submitting the following request:

PATCH /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tom-nhtest/providers/Microsoft.NotificationHubs/namespaces/tom-nhnamespace/notificationHubs/tom-nothub HTTP/1.1
...

{"properties":{"ApnsCredential":null}}

which returns a 200 OK which is :thumbs_up:. However I'm unable to replicate this request using the Go SDK as the top level properties have the attribute omitempty; setting this to an empty object gets translated as (in this case, trying to remove the APNS Credentials):

{
	"location": "westeurope",
	"properties": {
		"apnsCredential": {}
	}
}

which returns an error from the API:

HTTP/1.1 400 Bad Request
...

{"error":{"message":"Request payload is not in the expected format.","code":"BadRequest"}}

As such I don't think there's a way of removing credentials from a Notification Hub using the SDK today. For the moment I can workaround this by making a DELETE call and force-recreating the Notification Hub, which whilst isn't great will allow us to ship this at the moment (albeit with a disclaimer).

Relevant PR from our side: hashicorp/terraform-provider-azurerm#1589

Thanks!

@marstr
Copy link
Member

marstr commented Jul 19, 2018

I think this one is going to need some investigation. I'm going to leave it for team triage tomorrow.

@joshgav
Copy link
Contributor

joshgav commented Jul 24, 2018

Hi @tombuildsstuff, have you considered the notificationhubs#Client.Patch method? (godoc).

Won't solve your problem but perhaps we can handle PATCH differently than PUT.

@vladbarosan
Copy link

@tombuildsstuff any luck with the workaround Josh mentioned ?

@tombuildsstuff
Copy link
Contributor Author

@vladbarosan sorry -haven't had a chance to look at that yet, I'll schedule some time in the calendar in a couple of weeks when I'm back to take a look.

@tzhanl tzhanl added the Mgmt This issue is related to a management-plane library. label Nov 18, 2020
@RickWinter RickWinter added the customer-reported Issues that are reported by GitHub users external to the Azure organization. label Jul 12, 2021
@ghost ghost added the needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team label Jul 12, 2021
@RickWinter RickWinter added needs-author-feedback Workflow: More information is needed from author to address the issue. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that and removed needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team labels Jul 19, 2021
@ghost ghost added the no-recent-activity There has been no recent activity on this issue. label Jul 27, 2021
@ghost
Copy link

ghost commented Jul 27, 2021

Hi, we're sending this friendly reminder because we haven't heard back from you in a while. We need more information about this issue to help address it. Please be sure to give us your input within the next 7 days. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!

@ghost ghost closed this as completed Aug 10, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Apr 11, 2023
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
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-author-feedback Workflow: More information is needed from author to address the issue. no-recent-activity There has been no recent activity on this issue. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
None yet
Development

No branches or pull requests

7 participants