7

After following the steps in Error while updating Discovery Service Registrations I am faced with a new problem.

When I try to add a new mapping to an existing WebApplication like below

Add-TtmMapping -PublicationID tcm:0-18-1 -WebApplicationID Website1_RootWebApp -RelativeUrl /dev/en/ -CmEnvironmentId Tridioncm_WWCMCEO1000DIT

I get the error

Add-TtmMapping : Unable to save item of type 'MappingData' with id 'Mapping6'. One or more errors occurred. An error occurred while communicating with CD Discovery Service 'http://url:8082/discovery.svc' in CD Environment 'CdEnvironment1'. Error performing batch request 400 BAD REQUEST The related used by item doesn't exist in database: Website1_RootWebApp

This part is strange, item doesn't exist in database: Website1_RootWebApp

Tracing this backwards, trying to find the error, I've explored the following

Is the WebApplication Id correct? Yes

Get-TtmWebApplication

ContextUrl           : /
WebsiteId            : Website1
EnvironmentPurpose   : Staging
CdEnvironment        :
ScopedRepositoryKeys : {}
Id                   : Website1_RootWebApp
ExtensionProperties  : {}

Does the WebApplication exist in CdEnvironment1? Yes

Get-TtmWebsite

BaseUrls             : {http://url}
CdEnvironmentId      : CdEnvironment1
EnvironmentPurpose   : Staging
CdEnvironment        :
ScopedRepositoryKeys : {}
Id                   : Website1
ExtensionProperties  : {}

So I am not sure why I am getting this error.

When I check on the Topology Manager side, I see similar answers

/ttm201501/CdEnvironments

{
 "@odata.context":"http://url:81/ttm201501/$metadata#CdEnvironments","value":[
    {
      "Id":"CdEnvironment1","ExtensionProperties":[

      ],"ScopedRepositoryKeys":[
],"EnvironmentPurpose":"Staging","DiscoveryEndpointUrl":"http://url:8082/discovery.svc","Credentials":{
        "@odata.type":"#Tridion.TopologyManager.Client.AnonymousServiceCredentials","AuthenticationType":"Anonymous"
      },"IsOffline":false
    }
  ]
}

/ttm201501/Websites

{
  "@odata.context":"http://url:81/ttm201501/$metadata#Websites","value":[
    {
      "Id":"Website1","ExtensionProperties":[

      ],"ScopedRepositoryKeys":[

      ],"BaseUrls":[
        "http://url"
      ],"CdEnvironmentId":"CdEnvironment1","EnvironmentPurpose":"Staging"
    }
  ]
}

/ttm201501/WebApplications

{
  "@odata.context":"http://url:81/ttm201501/$metadata#WebApplications","value":[
    {
      "Id":"Website1_RootWebApp","ExtensionProperties":[

      ],"ScopedRepositoryKeys":[

      ],"ContextUrl":"/","WebsiteId":"Website1","EnvironmentPurpose":"Staging"
    }
  ]
}

/ttm201501/Mappings

{
  "@odata.context":"http://url:81/ttm201501/$metadata#Mappings","value":[
    {
      "Id":"Mapping2","ExtensionProperties":[

      ],"CmEnvironmentId":"Tridioncm_WWCMCEO1000DIT","PublicationId":"tcm:0-9-1","EnvironmentPurpose":"Staging","WebApplicationId":"Website1_RootWebApp","RelativeUrl":"/ww/en","PrimaryMappedUrl":"http://url/ww/en","IsOffline":false
    },{
      "Id":"Mapping5","ExtensionProperties":[

      ],"CmEnvironmentId":"Tridioncm_WWCMCEO1000DIT","PublicationId":"tcm:0-16-1","EnvironmentPurpose":"Staging","WebApplicationId":"Website1_RootWebApp","RelativeUrl":"/ww/fr","PrimaryMappedUrl":"http://url/ww/fr","IsOffline":false
    }
  ]
}

I think that the problem could be the following

Before executing steps in Error while updating Discovery Service Registrations DefaultWeb (in my discovery database) was Website1_RootWebApp

If I sync with WebCapability commented out, there is no DefaultWeb

If I sync with WebCapability included, I have two DefaultWeb rows, each with a GUID. There is no sign of Website1_RootWebApp

  • 3
    Can you also try to sync Topology Manager items then? Using cmdlet 'Sync-TtmCdEnvironment -Id CdEnvironment1' and check if it will return any errors. This command should delete all previous data related to Topology Manager items in Discovery service and re-create them again. Topology Manager items will not be touched though. – Stanislav Maryenko Jun 14 '16 at 7:29
  • If all else fails, you could recreate your Discovery Service DB, register the Capabilities again and then use Sync-TtmCdEnvironment to synchronize with Topology Manager. – Rick Pannekoek Jun 14 '16 at 17:55
  • 1
    Stan, if you can expand that into and answer you win the prize – Chris Morgan Jun 16 '16 at 6:47
  • I had the same issue. I ran Sync-TtmCdEnvironment and then Add-TtmMapping worked. – M Roweth Dec 7 '16 at 15:17
  • Sync-TtmCdEnvironment is the best way to fix it. make sure discovery.svc is accessible from your CMS. – Vikas Kumar Jul 25 '17 at 4:52
4

Sync-TtmCdEnvironment is the best way to fix it. make sure discovery.svc is accessible from your CMS

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.