Closed laura-vuilleumier closed 1 day ago
Update on this, removing the ExpirationTime
element from each registration allows the import to work. This was definitely not an issue in the past though, why is it happening now? We've had to export, manually remove all the dates, then import to get it working which is less than ideal.
Thank you @laura-vuilleumier !
I had the same problem with bulk delete using NotificationHubJobType.ImportDeleteRegistrations
.
Removing ExpirationTime
elements from the XML worked.
I tried several attempts removing other seemingly redundant data for deletion, but ExpirationTime
seems to be the culprit. Not sure if relevant, but all my values were <ExpirationTime>9999-12-31T23:59:59.9999999Z</ExpirationTime>
.
Docs should be updated if this is not a bug or will not be fixed: https://learn.microsoft.com/en-us/azure/notification-hubs/export-modify-registrations-bulk
Hi @laura-vuilleumier, I cannot make the export and then reimport work. I have tried eliminating registration id, expiration date. But there is no obvious error message anywhere. The job simply creates an empty Output.txt and Failed.txt on the destination storage blob container.
Do you have any hint to guide me?
Thanks in advance!
@dtap001 I have not tried this, but I earlier found this SO answer that describes import using:
<RegistrationId i:nil="true" />
You may need to specify the i
XML namespace too, if not already described in your XML.
I'd give it a try.
Found it. If there is any error during Job execution. The error wont be printed out. I solved it by invoking the action that I want to run on the notification hub client e.g.: hubClient.CreateRegistrationAsync(dto);
In my case I had invalid chars in one of the registration tag key: '$'
@angularsen Thanks for the prompt reaction!
i should clarify here that importing a registration with an installationId tag won't work. we don't currently support importing / exporting installations. it seems the community has the found issue - attempting to import registrations with an expirationtime will result in failure. we're closing this out as the OP has resolved their issue with importing.
@lomagdal2 Just to clarify once more for future reference.
Not sure about importing, but you can export installations, right?
In my experience, exporting registrations includes installations, since installations seem to be backwards compatible with registrations, but adds some extra tags like $InstallationId:{id}
, $UserId:{id}
etc. Is my understanding correct?
You cannot use $ in the keys of tags when importing. Honestly I don't understand what @lomagdal2 saying, because this workflow is working 100%:
Describe the bug I am looking to move registrations from one notification hub to another. I am doing a simple bulk export to a blob file, then using that file as the import file for the bulk import into the new notification hub. I am not manipulating the exported registrations at all. However after the import is completed, all registrations fail to import with the message
BadRequest,Bad Format
. There is no explanation as to why, and the format has not been changed since exporting. I have run this exact code in the past (2021) and it was successful, but it no longer works.To Reproduce
Upload a file to Azure storage account container containing the following (data has been anonymised, but this is a snippet of the result of our export):
Create a new job of type
ImportCreateRegistrations
using the above file as the import file, and wait to complete.Navigate to output container. Ouput.txt is empty, and Failed.txt contains all above registrations which failed to create with error BadRequest,Bad Format.
Code snippet I'm using code ripped directly from the README of this project.
Export code:
Import code:
Expected behavior I expect registrations to create successfully when imported, as the format is correct.
Setup (please complete the following information):