One of these days…

Many years ago, I heard a joke:

3 people (a biologist, a mathematician and a developer) were in Africa on a Safari. They drive by a blue elephant. The biologist shouts out: “Look, there is a BLUE elephant.”. The mathematician states: “Right you are, there is ONE blue elephant”. The developer slaps his palm against his forehead and says: “Damn, there are blue elephants…

As developers we often make assumptions and when we see these assumptions no longer being true, we immediately start thinking: What does that mean to my code and what does that mean to the people using my code.

This morning (August 18th 2020)

This morning, I woke up at 5:30 and as usual, the first thing I do is to scan email subjects. One email from Ryan caught my attention and in the email I could see a short output of the problem he was encountering:

Downloading Prerequisite Components
Downloading F:\bcart.cache\sandbox\16.4.14693.15627\platform\Prerequisite Components\Open XML SDK 2.5 for Microsoft Office\OpenXMLSDKv25.msi
Downloading F:\bcart.cache\sandbox\16.4.14693.15627\platform\Prerequisite Components\IIS URL Rewrite Module\rewrite_2.0_rtw_x64.msi
[2020-08-17 22:42:36] Exception calling "DownloadFile" with "2" argument(s): "The remote server returned an error: (404) Not Found."

What…

Did URL rewrite just disappear from Microsoft Download?

Can that happen?

and yes, the URL used in all docker images and artifacts to download URL rewrite is dead as of this morning… – there are blue elephants!

Impact

The impact of this is pretty severe.

The dead URL is stamped into all artifacts and all docker images ever created.

During artifact download, the pre-requisites are also downloaded and that will fail. If you already have the artifacts downloaded and cached, you are good to go.

If you use Microsoft hosted agents for CI/CD pipelines, artifacts cannot download and your build will fail.

Next major / Next minor pipelines will likely fail as well.

The fix?

I will try to get Microsoft Download to restore the file. That can however take some time and we cannot have pipelines failing all over the world for days…

In the meantime, I have created an Azure CDN with the pre-requisites used and in the Download-File function in containerhelper, I have added a replacement url array, meaning that if any attempt is made to download the dead url, it will be downloaded from my own cdn instead.

This fix is available in BcContainerHelper 1.0.3, which already has shipped (9am), and in NavContainerHelper 0.7.0.25, which ships in a few hours.

The same fix is added to Generic image 0.1.0.16 which also is available now.

So basically with an updated NavContainerHelper or BcContainerHelper and new generic images you should be good to go.

Sorry for the inconvenience

Freddy Kristiansen
Technical Evangelist

12 thoughts on “One of these days…

  1. Hi Freddy,

    I’m getting below error when trying to install BcContainerHelper (I’ve tried to uninstall navcontainerhelper and re-install – that works fine):

    PS C:\WINDOWS\system32> Install-Module BcContainerHelper -force
    PackageManagement\Install-Package : The following commands are already available on this system:’Add-FontsToBCContainer,Backup-BCContainerDatabases,Compile-AppInBCCont
    ainer,Copy-CompanyInBCContainer,Copy-FileFromBCContainer,Copy-FileToBCContainer,Create-AlProjectFolderFromBcContainer,Create-AadAppsForBC,Create-AadUsersInBCContainer,
    Enter-BCContainer,Export-BCContainerDatabasesAsBacpac,Extract-FilesFromBCContainerImage,Extract-FilesFromStoppedBCContainer,Get-BCContainerApiCompanyId,Get-BCContainer
    App,Get-BCContainerAppInfo,Get-BCContainerAppRuntimePackage,Get-BCContainerArtifactUrl,Get-BCContainerBCUser,Get-BCContainerCountry,Get-BCContainerDebugInfo,Get-BCCont
    ainerEula,Get-BCContainerEventLog,Get-BCContainerGenericTag,Get-BCContainerId,Get-BCContainerImageLabels,Get-BCContainerImageName,Get-BCContainerImageTags,Get-BCContai
    nerIpAddress,Get-BCContainerLegal,Get-BCContainerName,Get-BCContainerNavVersion,Get-BCContainerOsVersion,Get-BCContainerPath,Get-BCContainerPlatformVersion,Get-BCConta
    iners,Get-BCContainerServerConfiguration,Get-BCContainerSession,Get-BCContainerSharedFolders,Get-BCContainerTenants,Get-BestBCContainerImageName,Get-CompanyInBCContain
    er,Get-TestsFromBCContainer,Import-BCContainerLicense,Import-ConfigPackageInBCContainer,Import-PfxCertificateToBCContainer,Import-TestToolkitToBCContainer,Install-BCCo
    ntainerApp,Install-NAVSipCryptoProviderFromBCContainer,Invoke-BCContainerApi,Invoke-ScriptInBCContainer,New-BCContainer,New-BCContainerBCUser,New-BCContainerTenant,New
    -BCContainerWindowsUser,New-BCContainerWizard,New-BCImage,New-CompanyInBCContainer,Open-BCContainer,Publish-BCContainerApp,Publish-NewApplicationToBcContainer,Remove-B
    CContainer,Remove-BCContainerSession,Remove-BCContainerTenant,Remove-CompanyInBCContainer,Remove-ConfigPackageInBCContainer,Repair-BCContainerApp,Replace-BCServerConta
    iner,Restart-BCContainer,Restore-DatabasesInBCContainer,Run-TestsInBCContainer,Setup-BCContainerTestUsers,Setup-TraefikContainerForBCContainers,Sign-BCContainerApp,Sta
    rt-BCContainer,Start-BCContainerAppDataUpgrade,Stop-BCContainer,Sync-BCContainerApp,Test-BCContainer,UnInstall-BCContainerApp,UnPublish-BCContainerApp,Wait-BCContainer
    Ready,Add-FontsToNavContainer,Add-GitToAlProjectFolder,Backup-NavContainerDatabases,Check-NavContainerHelperPermissions,Clean-BcContainerDatabase,Compile-AppInNavConta
    iner,Compile-ObjectsInNavContainer,Convert-AlcOutputToAzureDevOps,Convert-ModifiedObjectsToAl,Convert-Txt2Al,Copy-AlSourceFiles,Copy-CompanyInNavContainer,Copy-FileFro
    mNavContainer,Copy-FileToNavContainer,Create-AlProjectFolderFromNavContainer,Create-MyDeltaFolder,Create-MyOriginalFolder,Create-AadAppsForNav,Create-AadUsersInNavCont
    ainer,Download-Artifacts,Download-File,Enter-NavContainer,Export-ModifiedObjectsAsDeltas,Export-NavContainerDatabasesAsBacpac,Export-NavContainerObjects,Extract-AppFil
    eToFolder,Extract-FilesFromNavContainerImage,Extract-FilesFromStoppedNavContainer,Flush-ContainerHelperCache,Generate-SymbolsInNavContainer,Get-BCArtifactUrl,Get-BestG
    enericImageName,Get-BestNavContainerImageName,Get-CompanyInNavContainer,Get-LatestAlLanguageExtensionUrl,Get-LocaleFromCountry,Get-NavArtifactUrl,Get-NavContainerApiCo
    mpanyId,Get-NavContainerApp,Get-NavContainerAppInfo,Get-NavContainerAppRuntimePackage,Get-NavContainerArtifactUrl,Get-NavContainerCountry,Get-NavContainerDebugInfo,Get
    -NavContainerEula,Get-NavContainerEventLog,Get-NavContainerGenericTag,Get-NavContainerId,Get-NavContainerImageLabels,Get-NavContainerImageName,Get-NavContainerImageTag
    s,Get-NavContainerIpAddress,Get-NavContainerLegal,Get-NavContainerName,Get-NavContainerNavUser,Get-NavContainerNavVersion,Get-NavContainerOsVersion,Get-NavContainerPat
    h,Get-NavContainerPlatformVersion,Get-NavContainers,Get-NavContainerServerConfiguration,Get-NavContainerSession,Get-NavContainerSharedFolders,Get-NavContainerTenants,G
    et-NavVersionFromVersionInfo,Get-TestsFromNavContainer,Import-ConfigPackageInNavContainer,Import-DeltasToNavContainer,Import-NavContainerLicense,Import-ObjectsToNavCon
    tainer,Import-PfxCertificateToNavContainer,Import-TestToolkitToNavContainer,Install-NavContainerApp,Install-NAVSipCryptoProviderFromNavContainer,Invoke-NavContainerApi
    ,Invoke-NavContainerCodeunit,Invoke-ScriptInNavContainer,New-CompanyInNavContainer,New-DesktopShortcut,New-LetsEncryptCertificate,New-NavContainer,New-NavContainerNavU
    ser,New-NavContainerTenant,New-NavContainerWindowsUser,New-NavContainerWizard,New-NavImage,Open-NavContainer,Publish-NavContainerApp,Publish-NewApplicationToNavContain
    er,Remove-CompanyInNavContainer,Remove-ConfigPackageInNavContainer,Remove-DesktopShortcut,Remove-NavContainer,Remove-NavContainerSession,Remove-NavContainerTenant,Rene
    w-LetsEncryptCertificate,Repair-NavContainerApp,Replace-DependenciesInAppFile,Replace-NavServerContainer,Restart-NavContainer,Restore-DatabasesInNavContainer,Run-Tests
    InNavContainer,Setup-NavContainerTestUsers,Setup-TraefikContainerForNavContainers,Sign-NavContainerApp,Sort-AppFoldersByDependencies,Start-NavContainer,Start-NavContai
    nerAppDataUpgrade,Stop-NavContainer,Sync-NavContainerApp,Test-NavContainer,UnInstall-NavContainerApp,UnPublish-NavContainerApp,Wait-NavContainerReady’. This module ‘Bc
    ContainerHelper’ may override the existing commands. If you still want to install this module ‘BcContainerHelper’, use -AllowClobber parameter.
    At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1809 char:21
    + … $null = PackageManagement\Install-Package @PSBoundParameters
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (Microsoft.Power….InstallPackage:InstallPackage) [Install-Package], Exception
    + FullyQualifiedErrorId : CommandAlreadyAvailable,Validate-ModuleCommandAlreadyAvailable,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

    Like

      • yes, I had navcontainerhelter version 0.7.0.2 installed and it would not uninstall. By deleting the folder for the installation (C:\Program Files\WindowsPowerShell\Modules\navcontainerhelper) I got it out and BcContainerHelper 1.0.3 did install after that. Thank you Freddy

        Like

    • Yes, if you are running 16.x containers on a machine where you have artifacts cache, it will work on the second run because the pre-req is already installed in the generic image and the new installer doesn’t attempt to use/download it. I didn’t want to recommend this as there is only one happy-path where 2nd run works.

      Like

  2. Hi Freddy

    I’m running below script

    #—– Init —–
    Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force

    #Install-Module BcContainerHelper -force
    Update-Module BcContainerHelper
    Import-Module BcContainerHelper

    #—– Credentials —–
    $username = “nav”
    $password = “1234Abcd” | ConvertTo-SecureString -asPlainText -Force
    $Cred = New-Object System.Management.Automation.PSCredential($username,$password)
    $auth = ‘UserPassword’

    #—- Create BC —-
    $containerName = ‘bcdkonprem’
    $imageName = ‘bc’
    $artifactUrl = Get-BcArtifactUrl -type ‘OnPrem’ -version ” -country ‘dk’ -select ‘Latest’
    New-BcContainer `
    -accept_eula `
    -containerName $containerName `
    -credential $Cred `
    -auth $auth `
    -artifactUrl $artifactUrl `
    -imageName $imageName `
    -assignPremiumPlan `
    -dns 1.1.1.1 `
    -shortcuts Desktop `
    -updateHosts

    And it seems to error on step 2/6 – below is my console output:

    BcContainerHelper is version 1.0.3
    BcContainerHelper is running as administrator
    Host is Microsoft Windows 10 Pro – 1909
    Docker Client Version is 19.03.12
    Docker Server Version is 19.03.12
    Removing C:\ProgramData\BcContainerHelper\Extensions\bcdkonprem
    ArtifactUrl and ImageName specified
    Fetching all docker images
    Image bc:onprem-16.4.14693.15445-dk doesn’t exist
    Building image bc:onprem-16.4.14693.15445-dk based on https://bcartifacts.azureedge.net/onprem/16.4.14693.15445/dk
    Building image bc:onprem-16.4.14693.15445-dk based on mcr.microsoft.com/dynamicsnav:10.0.18363.959-generic
    bc:onprem-16.4.14693.15445-dk
    Pulling latest image mcr.microsoft.com/dynamicsnav:10.0.18363.959-generic
    10.0.18363.959-generic: Pulling from dynamicsnav
    Generic Tag: 0.1.0.16
    Container OS Version: 10.0.18363.959 (1909)
    Host OS Version: 10.0.18363.959 (1909)
    Using process isolation
    Files in c:\bcartifacts.cache\tmp637333562987605339\my:
    Copying Platform Artifacts
    Copying Database
    Copying Licensefile
    Copying Installers
    Copying ConfigurationPackages
    Copying Applications
    c:\bcartifacts.cache\tmp637333562987605339
    Sending build context to Docker daemon 1.398GB

    Step 1/6 : FROM mcr.microsoft.com/dynamicsnav:10.0.18363.959-generic
    —> 587731de5e0f
    Step 2/6 : ENV DatabaseServer=localhost DatabaseInstance=SQLEXPRESS DatabaseName=CRONUS IsBcSandbox=N artifactUrl=https://bcartifacts.azureedge.net/onprem/16.4.14693.15445/dk
    —> Running in f08555c33ec6
    hcsshim::PrepareLayer – failed failed in Win32: Incorrect function. (0x1)
    Building image took 58 seconds
    Using image bc:onprem-16.4.14693.15445-dk
    Error: No such object: bc:onprem-16.4.14693.15445-dk
    The property ‘Config’ cannot be found on this object. Verify that the property exists.
    At C:\Program Files\WindowsPowerShell\Modules\BcContainerHelper\1.0.3\ContainerHandling\New-NavContainer.ps1:845 char:9
    + $devCountry = $inspect.Config.Labels.country
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : PropertyNotFoundStrict

    Like

  3. Hi Freddy,
    I tried to create a container today and I have upgraded to 1.0.3 and it appears to fail again?
    Did I miss something 🙂

    Installing Business Central
    Downloading Url Rewrite
    Exception calling “DownloadFile” with “2” argument(s): “The remote server returned an error: (404) Not Found.”
    at InstallPrerequisite, C:\Run\HelperFunctions.ps1: line 579
    at , C:\Run\navinstall.ps1: line 30
    at , C:\Run\start.ps1: line 282
    at , : line 1
    Initialization of container BC14-Demo failed
    At C:\Program Files\WindowsPowerShell\Modules\BcContainerHelper\1.0.3\ContainerHandling\Wait-NavContainerReady.ps1:43 char:17
    + … throw “Initialization of container $containerName failed” …
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : OperationStopped: (Initialization …C14-Demo failed:String) [], RuntimeException
    + FullyQualifiedErrorId : Initialization of container BC14-Demo failed

    PS C:\WINDOWS\system32> Get-InstalledModule -Name BcContainerHelper

    Version Name Repository Description
    ——- —- ———- ———–
    1.0.3 BcContainerHelper PSGallery PowerShell module

    Like

  4. Pingback: ArcherPoint Dynamics NAV Business Central Developer Digest - vol 309 - Microsoft Dynamics NAV Community

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s