Package migration causes 503 when reinstalling starter kit with conflicting templates

Hello!

I’ve just slammed my head against a brick wall for the last couple of days trying to figure this out… It was just supposed to be a quick 20 minute coding adventure, in and out…

So we have our own starter kit with a package.xml file as an EmbeddedResource. The package.xml file contains some document types and some templates.

If we install the starter kit on a site with a SQLite database, then remove the database connection string in appsettings.json, remove the database, and then install everything again. We receive this error after the Installation: {"title":"Service Unavailable","status":503,"detail":"The application is currently being upgraded. Please try again later."}. And we’re not able to move on from this screen. We are just stuck here now, with no errors in the logs.

It took me ages to figure out. But if I delete the views that were created by the starter kit and then do a fresh install, it works as intended. I only got this far by finding a log entry labeled Information: Package migration executed. Summary: Conflicting templates found, they will be overwritten: {template files}

It seems like there is an issue when it tries to overwrite the templates?

I’ve only tested this using SQLite so far. I will test with SQL Server as well, but I just need a quick break from this issue first.

Just to give as much context as possible, here is how the migrations look. We are currently running Umbraco 17.4.2.

namespace Starterkit.Migrations
{
    public class ImportPackageXmlMigration : AsyncPackageMigrationBase
    {
        private readonly ILogger<ImportPackageXmlMigration> _logger;
        public ImportPackageXmlMigration(
			ILogger<ImportPackageXmlMigration> logger,
			IPackagingService packagingService,
            IMediaService mediaService,
            MediaFileManager mediaFileManager,
            MediaUrlGeneratorCollection mediaUrlGenerators,
            IShortStringHelper shortStringHelper,
            IContentTypeBaseServiceProvider contentTypeBaseServiceProvider,
            IMigrationContext context,
            IOptions<PackageMigrationSettings> packageMigrationsSettings)
            : base(packagingService,
                  mediaService, 
                  mediaFileManager,
                  mediaUrlGenerators,
                  shortStringHelper,
                  contentTypeBaseServiceProvider,
                  context,
                  packageMigrationsSettings)
        {
            _logger = logger;
        }

		protected async override Task MigrateAsync()
		{
            ImportPackage.FromEmbeddedResource<ImportPackageXmlMigration>().Do();
		}
	}
}

And

namespace Starterkit.Migrations
{
    public class StarterKitPackageMigrationPlan : PackageMigrationPlan
    {
        public StarterKitPackageMigrationPlan() : base("Starterkit") { }

        protected override void DefinePlan()
        {
            To<ImportPackageXmlMigration>(new Guid("2ad063be-68ad-4434-b7f4-acfc43cf87bf"));
        }
    }
}

The package.xml was originally created in Umbraco 8, so it doesn’t look particularly healthy in the new backoffice and shows a bunch of errors. But it seems to work as expected.


Has anyone run into this before? Is this a known issue with template overwriting during package migrations?

Hi @Lantzify

I know there have been changes to the import of package.xml, specifically regarding templates - as mentioned in this thread:

If you’re experiencing issues with this in v17 and this used to work in previous versions, then I suggest you raise it as a regressions issue on the issue tracker for HQ to take a look at:

You’ve already done some of the investigation work so you’re most of the way there.

Import via packages.xml is still supported as it is mentioned here in the docs:

It looks like there’s some issues though as you’ve discovered.

Justin