0

Hi I have completed the firebase init and firebase deploy --only hosting. It shown the successful modal message of

"Welcome Firebase Hosting Setup Complete

You're seeing this because you've successfully setup Firebase Hosting. Now it's time to go build something extraordinary!"

But it does not show my website however.

I have tried Firefox and IE Edge but still shows the same message.

Please see my firebase.json file:

{
  "functions": [
    {
      "source": "functions",
      "codebase": "default",
      "ignore": [
        "node_modules",
        ".git",
        "firebase-debug.log",
        "firebase-debug.*.log"
      ]
    }
  ],
  "database": {
    "rules": "database.rules.json"
  },
  "firestore": {
    "rules": "firestore.rules",
    "indexes": "firestore.indexes.json"
  },
  "hosting": {
    "public": "dist/cook4u",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]
  },
  "storage": {
    "rules": "storage.rules"
  },
  "emulators": {
    "auth": {
      "port": 9099
    },
    "functions": {
      "port": 5001
    },
    "firestore": {
      "port": 8080
    },
    "database": {
      "port": 9000
    },
    "hosting": {
      "port": 5000
    },
    "pubsub": {
      "port": 8085
    },
    "storage": {
      "port": 9199
    },
    "eventarc": {
      "port": 9299
    },
    "ui": {
      "enabled": true
    },
    "singleProjectMode": true
  },
  "remoteconfig": {
    "template": "remoteconfig.template.json"
  }
}

I have tried the solutions in stackoverflow and other websites. It does not solve my problem. I have confirmed that my index.html and all my source code is in my public folder. Also, how to determine which page is the landing page of my website?

Here is my public folder. Is there anything I am missing?

public folder screenshot

Dist folder screenshot:

dist folder screenshot

cook4u folder screenshot

Here is the output when I run the deploy command:

  • hosting[cook4u-b3b8d]: file upload complete i hosting[cook4u-b3b8d]: finalizing version...
  • hosting[cook4u-b3b8d]: version finalized i hosting[cook4u-b3b8d]: releasing new version...
  • hosting[cook4u-b3b8d]: release complete i hosting[cook4u-b3b8d]: beginning deploy...
  • Deploy complete!3b8d]: found 119 files in public

Project Console: https://console.firebase.google.com/project/cook4u-b3b8d/overview Hosting URL: https://cook4u-b3b8d.web.app

dansyw91
  • 5
  • 4
  • Can you share a screenshot of `dist` folder? – Dharmaraj Feb 04 '23 at 09:44
  • @Dharmaraj no problem. edited post with added screenshots. – dansyw91 Feb 04 '23 at 09:48
  • The config looks fine to me. What was the output when you run deploy command? Also have you tried accessing the URL from any other browser or device just in case its cached for you? – Dharmaraj Feb 04 '23 at 09:49
  • @Dharmaraj also posted here for you. – dansyw91 Feb 04 '23 at 10:03
  • Thanks for the details. That just seems like initializing Firebase project. Did you try deploying by running `firebase deploy --only hosting`? – Dharmaraj Feb 04 '23 at 10:11
  • @Dharmaraj apologies, just revised the output for `firebase deploy --only hosting`. It is also shown in my firebase console as "current" in release history. – dansyw91 Feb 04 '23 at 10:22
  • Why are there PHP files in your uploaded directory? Unless something changed recently, Firebase Hosting is static and doesn't handle PHP. Additionally your rewrites make every page fall back to `index.html` which may be causing more issues. – samthecodingman Feb 04 '23 at 10:44
  • @samthecodingman thanks for pointing out. I was actually coding for mysql all the time. I then decided to host on firebase. I did not know they do not support php. What shall I do in this case? Do I have to recode everything all over? – dansyw91 Feb 04 '23 at 11:35
  • If you want to continue using Firebase Hosting and Cloud Functions, for long term maintainability, you should rebuild your project following the conventions of the JavaScript language rather than feed it to some PHP conversion tool. If you want to keep using PHP, you'll have to do some research as I am not familiar with any PHP hosts because I haven't used that language in over a decade at this point. – samthecodingman Feb 05 '23 at 22:26

1 Answers1

0

delete your .firebase file

  1. firebase init
  2. Configure as a single-page app (rewrite all urls to /index.html)? (y/N) n

use no this change your index.html file