Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase Dynamic Links subdomain config

Let's say I have a domain example.com. And I created a second website through hosting and cli as sub.example.com.

{
  "hosting": [
    {
      "target": "app",
      "public": "public",
      "rewrites": [
        {
          "source": "**",
          "destination": "/index.html"
        }
      ]
    },
    {
      "target": "promos",
      "public": "public",
      "appAssociation": "AUTO",
      "rewrites": [
        {
          "source": "**",
          "dynamicLinks": true
        }
      ]
    }
  ]
}

Now when I go to create Dynamic Link for sub.example.com without any path prefix, it gives me a red flag saying:

It looks like you already have content served on this path. Specify a different path prefix to avoid conflicts with existing content.
  1. What am I doing wrong?
  2. Also, if this subdomain is only for links, I still have to put public field? I don't want to show anything on it, just links...
like image 252
cocacrave Avatar asked Mar 16 '20 09:03

cocacrave


People also ask

How do I activate dynamic links in Firebase?

Enable Firebase Dynamic Links for your Firebase project in the Firebase console. Then, include the Dynamic Links SDK in your app. You can create Dynamic Links programmatically or by using the Firebase console. When your app opens, use the Dynamic Links SDK to check if a Dynamic Link was passed to it.

How do I customize my URL on Firebase?

Open the Dynamic Links page of the Firebase console. If you haven't used Dynamic Links before, click Get Started. Otherwise, click Add URL prefix from the drop-down menu. Then, complete the setup wizard, specifying the domain and path prefix you want to use when prompted.

Do Firebase dynamic links expire?

The created short Dynamic Link will not expire. Repeated calls with the same long Dynamic Link or Dynamic Link information will produce the same short Dynamic Link. The Dynamic Link domain in the request must be owned by requester's Firebase project.


2 Answers

I fixed it by adding (or rather ignoring) the public folder for the dynamic links subdomain.

"ignore": [
    "*"
  ],

I saw this post: https://github.com/firebase/firebase-tools/issues/566 and someone asked similar question for functions and the answer was to delete dist/index.html. But since my actual site depends on it, I tried just ignoring it and it seems to work.

like image 142
cocacrave Avatar answered Oct 17 '22 02:10

cocacrave


I fixed the same issue with @cocacrave's answer. Just sharing the full firebase.json file. * There should be a public folder and settings but my public folder is empty.

{
  "hosting": {
    "public": "public",
    "ignore": [
      "*"
    ],
    "appAssociation": "AUTO",
    "rewrites": [
      {
        "source": "/**",
        "dynamicLinks": true
      }
    ]
  }
}
like image 43
fatihyildizhan Avatar answered Oct 17 '22 03:10

fatihyildizhan