25

i am having issue with mapping domain in google cloud platform so i have just verified my domain but then i am having this issue  i am having error " mydomain.com is already mapped to my project"

but the thing is that i have not added my domain to my project yet as you can see below in picture

i have not added w3youtube.com to mapping

so i have not added "w3youtube.com" to mapping or created any dns records but still i am having www.w3youtube.com is already mapped to a project.

enter image description here

what should i do? in order to remove mappings or to resolve this issue?

Kartik Garasia
  • 1,324
  • 1
  • 18
  • 27

3 Answers3

38

As of 2018, the command line requests alone didn't work for me. What worked for me were these instructions from the Google Group here. In short,

  1. Head over to the API Explorer.

  2. Fill out the form in this format below: API Explorer settings

  3. Make sure you Enable OAuth and execute the request.

  4. If successful, you'll see a response like this below:

    200
    
    - Show headers -
    
    {
     "name": "apps/example/operations/abcde-efgh-ijkl-mnop
     "metadata": {
      "@type": "type.googleapis.com/google.appengine.v1.OperationMetadataV1",
      "method": "google.appengine.v1.DomainMappings.CreateDomainMapping",
      "insertTime": "2018-03-16T03:44:49.167Z",
      "user": "you@example.com",
      "target": "apps/example/domainMappings/example.com"
     }
    }
    

    Important note: You need to run this request TWICE - Once for your domain without www (example.com). And once with www (www.example.com). I missed this step and my app stop serving www.example.com.

  5. To (re)-enable SSL support: Go back to your cloud console and then AppEngine domain settings and click the "Enable Managed Security" button as shown below: Enable SSL settings

  6. If it still doesn't work, you can delete the domain from your console and re-add it through the command line using the command below:

    gcloud beta app domain-mappings create <domain name>
    

    Keep in mind, the above command will only work once you've run the request through the API explorer.

Hope this helps.

Cheers.

dsignr
  • 2,295
  • 2
  • 35
  • 45
  • If you use `gcloud app domain-mappings create` it will now give you a helpful error that you need this flag. Following these instructions worked for me. The full error was: `App [project-id] is the subject of a conflict: Domain 'www.example.com' is already mapped to another application. You must delete the existing domain mapping before you can re-map the domain, or you may specify 'DomainOverrideStrategy.OVERRIDE' on the request to force overwrite the existing mapping. Domain 'www.example.com' is currently mapped to an application on which you do not have permissions.` – Evan Jones Apr 18 '18 at 18:22
  • The screenshot didn't show up. So I record my parameters here. overrideStrategy=OVERRIDE, Request.body.id=example.com – Hanson Mar 23 '21 at 07:04
  • 1
    You've saved the day for me when I lost access to my prior GCP project (due to Google Workspace user deletion) – Robert Jul 29 '22 at 21:59
  • Glad I could be of help, Robert. – dsignr Aug 03 '22 at 06:00
  • 1
    works the same way in 2023. thanks! – sunsetjunks May 30 '23 at 20:43
20

Easy steps:

  1. try to map a domain with the following command: gcloud app domain-mappings create <domain>
  2. and then you'll see something like: <your_domain> is currently mapped to application '<project>'.
  3. and after you know which project use that domain, you can easily delete the mapped one with this command: gcloud --project <project_name> app domain-mappings delete <your_domain>
Burhan Mubarok
  • 358
  • 2
  • 8
  • 1
    Thanks, it worked for me. Just need to run same delete code for each https:// and www. and subdomains. – Cem Jan 05 '21 at 21:18
11

Try using gcloud command line tool instead of using web console. I was able to resolve through it. gcloud beta app domain-mappings create <domain name> Also, use of beta in the above command will add managed certificate for SSL automatically.

sunzoje
  • 166
  • 1
  • 6
  • It worked for me. Actually that command did not add CNAME record for www, but added all of the rest records. After that I was able to see and manage them in admin console, so I deleted and recreated all of them. Of course before start mapping domain make sure that another account/project is not mapped to it. – MantasG Dec 30 '17 at 08:29
  • This still works. Thanks! And once added from the command line, it shows up on the console.cloud.google.com – Teddy Aug 17 '18 at 18:25