I want to do a simple application with a small firestore database, but after I finish initializing my app if I try to emulate hosting, it has some server issues. This is an example (with hosting port 5000): firebase hosting error but when I'm doing this on npm (as I usually do with most of my apps) it works as it was expected (with port 3000): web page working on npm
I don't know if this was a bad installation or if I did not put the credentials correctly but a while ago I made a complete web page and I cannot make it work due to this error
=== Hosting Setup
Your public directory is the folder (relative to your project directory) that
will contain Hosting assets to be uploaded with firebase deploy. If you
have a build process for your assets, use your build's output directory.
? What do you want to use as your public directory? public
? Configure as a single-page app (rewrite all urls to /index.html)? Yes
? Set up automatic builds and deploys with GitHub? No
? File public/index.html already exists. Overwrite? No
I Skipping write of public/index.html
=== Emulators Setup
? Which port do you want to use for the hosting emulator? 5000
? Would you like to enable the Emulator UI? Yes
? Which port do you want to use for the Emulator UI (leave empty to use any available port)?
? Would you like to download the emulators now? No
I Writing configuration info to firebase.json...
I Writing project information to .firebaserc...
+ Firebase initialization complete!
my actual code in app.js is this:
import React from "react";
const App = () => {
return <div>App</div>;
};
export default App;
and even if i initialize the app at the top of the file like this the error is persiting
import { initializeApp } from "firebase/app";
const firebaseConfig = {
apiKey: process.env.REACT_APP_FIREBASE_API_KEY,
authDomain: process.env.REACT_APP_FIREBASE_AUTH_DOMAIN,
projectId: process.env.REACT_APP_FIREBASE_PROJECT_ID,
storageBucket: process.env.REACT_APP_FIREBASE_STORAGE_BUCKET,
messagingSenderId: process.env.REACT_APP_FIREBASE_SENDER_ID,
appId: process.env.REACT_APP_FIREBASE_APP_ID,
};
// Initialize Firebase
const app = initializeApp(firebaseConfig);
const db = getFirestore(app)
I'm quite new in the firebase world so any help is welcome, thanks :)