How should I host the website on firebase? - firebase

after calling firebase init in vs code terminal, then opting Hosting, then opting to choose the existing projects
i am facing the below error
Error: Failed to list Firebase projects. See firebase-debug.log for more info.
how should i resolve it?
firebase log file
at Client.doRequest (/usr/local/lib/node_modules/firebase-tools/lib/apiv2.js:209:23)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async Client.request (/usr/local/lib/node_modules/firebase-tools/lib/apiv2.js:96:20)
at async getProjectPage (/usr/local/lib/node_modules/firebase-tools/lib/management/projects.js:233:17)
at async getFirebaseProjectPage (/usr/local/lib/node_modules/firebase-tools/lib/management/projects.js:250:23)
at async selectProjectInteractively (/usr/local/lib/node_modules/firebase-tools/lib/management/projects.js:95:41)
at async Object.doSetup [as project] (/usr/local/lib/node_modules/firebase-tools/lib/init/features/project.js:87:27)
at async init (/usr/local/lib/node_modules/firebase-tools/lib/init/index.js:19:9)
[error]
[error] Error: Failed to list Firebase projects. See firebase-debug.log for more info.
please guide

Related

Error to DEPLOY next.js 13 with Firebase: TypeError: Cannot read properties of null (reading 'toString')

i'm in trouble to connect Firebase to next 13, already search for it on internet and a lot of people had similar problems
Error:
[debug] [2023-02-08T18:54:22.084Z] TypeError: Cannot read properties of null (reading 'toString')
at ɵcodegenFunctionsDirectory (C:\Users\idieg\AppData\Roaming\npm\node_modules\firebase-tools\lib\frameworks\next\index.js:222:18)
at async prepareFrameworks (C:\Users\idieg\AppData\Roaming\npm\node_modules\firebase-tools\lib\frameworks\index.js:306:84)
at async deploy (C:\Users\idieg\AppData\Roaming\npm\node_modules\firebase-tools\lib\deploy\index.js:53:13)
[error]
[error] Error: An unexpected error has occurred.
also like to clarify that i already can emulate this without bugs and also ran the firebase experiments:enable webframeworks but i need to deploy it.

FirebaseError: Installations: Create Installation request failed with error "403 PERMISSION_DENIED

I was working with Firebase with Angular framework in a project. I was using Firebase for sending push notifications. I followed this medium article and did like this. Everything was perfect up to allowing notification alerts. But after that token didn't print on the console and this error popped up.
`
notifications.component.ts:169 FirebaseError: Installations: Create Installation request failed with error "403 PERMISSION_DENIED: Requests to this API firebaseinstallations.googleapis.com method google.firebase.installations.v1.FirebaseInstallationsService.CreateInstallation are blocked." (installations/request-failed).
at index.esm2017.js:94:26
at Generator.next (<anonymous>)
at asyncGeneratorStep (asyncToGenerator.js:3:1)
at _next (asyncToGenerator.js:25:1)
at ZoneDelegate.invoke (zone.js:372:1)
at Object.onInvoke (core.mjs:25488:1)
at ZoneDelegate.invoke (zone.js:371:1)
at Zone.run (zone.js:134:1)
at zone.js:1276:1
at ZoneDelegate.invokeTask (zone.js:406:1)
`
And I found this StackOverflow answer as well and I did the same as that suggested. But still it gives the error.
Can someone help me with this?

Error: Unsupported operation: Platform._operatingSystem

I want build app flutter on web but I get error when I run
flutter run -d chrome
error
Error: Unsupported operation: Platform._operatingSystem
at Object.throw_ [as throw] (http://localhost:55259/dart_sdk.js:5334:11)
at Function._operatingSystem (http://localhost:55259/dart_sdk.js:56144:17)
at Function.get operatingSystem [as operatingSystem] (http://localhost:55259/dart_sdk.js:56190:27)
at get _operatingSystem (http://localhost:55259/dart_sdk.js:56103:27)
at Function.desc.get [as _operatingSystem] (http://localhost:55259/dart_sdk.js:5839:17)
at Function.get operatingSystem [as operatingSystem] (http://localhost:55259/dart_sdk.js:56056:26)
at main$ (http://localhost:55259/packages/doxaspc/main.dart.lib.js:205:48)
at main$.next (<anonymous>)
at http://localhost:55259/dart_sdk.js:39032:33
at _RootZone.runUnary (http://localhost:55259/dart_sdk.js:38889:58)
at _FutureListener.thenAwait.handleValue (http://localhost:55259/dart_sdk.js:33875:29)
at handleValueCallback (http://localhost:55259/dart_sdk.js:34435:49)
at Function._propagateToListeners (http://localhost:55259/dart_sdk.js:34473:17)
at _Future.new.[_completeWithValue] (http://localhost:55259/dart_sdk.js:34315:23)
at async._AsyncCallbackEntry.new.callback (http://localhost:55259/dart_sdk.js:34338:35)
at Object._microtaskLoop (http://localhost:55259/dart_sdk.js:39176:13)
at _startMicrotaskLoop (http://localhost:55259/dart_sdk.js:39182:13)
at http://localhost:55259/dart_sdk.js:34689:9
function main of me
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(MyApp());
}
I have build a app android and it work good. but when I want anable web see error above
please show me how fix it?
I had the same error with a mobile flutter app to configure in Web.
It was because some packages are available only for Android and IOS, and not for the Web.
Maybe you should replace your packages with an equivalent available for all platforms.
FlutterFire plugins for web may still be errorneous
Please follow the guide as suggested here

I am getting error while deploying google cloud functions. Error - 'Invalid contents in the credentials file'

I am getting error while deploying google cloud function - with firebase (earlier it was working fine but suddenly this error started coming so I deleted the whole folder and did the process again but still not resolved)
index.js
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp();
const db = admin.firestore();
.
.
.
Console
✔ functions: Finished running predeploy script.
i functions: ensuring necessary APIs are enabled...
✔ functions: all necessary APIs are enabled
i functions: preparing functions directory for uploading...
Error: Error occurred while parsing your function triggers.
Error: Invalid contents in the credentials file
at FirebaseAppError.FirebaseError [as constructor] (/Users/shayana/Documents/calleWork/calle/functions/node_modules/firebase-admin/lib/utils/error.js:42:28)
at FirebaseAppError.PrefixedFirebaseError [as constructor] (/Users/shayana/Documents/calleWork/calle/functions/node_modules/firebase-admin/lib/utils/error.js:88:28)
at new FirebaseAppError (/Users/shayana/Documents/calleWork/calle/functions/node_modules/firebase-admin/lib/utils/error.js:123:28)
at credentialFromFile (/Users/shayana/Documents/calleWork/calle/functions/node_modules/firebase-admin/lib/auth/credential.js:342:11)
at new ApplicationDefaultCredential (/Users/shayana/Documents/calleWork/calle/functions/node_modules/firebase-admin/lib/auth/credential.js:307:32)
at FirebaseNamespaceInternals.initializeApp (/Users/shayana/Documents/calleWork/calle/functions/node_modules/firebase-admin/lib/firebase-namespace.js:61:34)
at FirebaseNamespace.initializeApp (/Users/shayana/Documents/calleWork/calle/functions/node_modules/firebase-admin/lib/firebase-namespace.js:408:30)
at Object.<anonymous> (/Users/shayana/Documents/calleWork/calle/functions/index.js:14:7)
at Module._compile (internal/modules/cjs/loader.js:936:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:947:10)
Based on what you've explained, and since the error you've received is about lack of credential, I really doubt that it has something to do with the function itself.
I can suggest two thing:
First: Update firebase-admin package,
Second: Set the service account and GOOGLE_APPLICATION_CREDENTIALS variable and initialize SDK explicitly following this procedure

firebase serve: supervisorPort (5001) is already in use

I built this React App, that allows users to add todo item, and mark an item as completed/active. Todo items are stored in cloud firestore.
I want to enable full-text search on the app, and one way is to create a cloud function that writes index to Algolia whenever cloud firestore witnesses a create operation.
Inside my app root directory, I initialize cloud functions and then implement the onTodoAdded function. After done, I run firebase serve under functions directory and get the errors:
=== Serving from '/Users/evan/source/react-redux-todos'...
i functions: Preparing to emulate functions.
Warning: You're using Node.js v10.6.0 but Google Cloud Functions only supports v6.11.5.
i hosting: Serving hosting files from: build
✔ hosting: Local server: http://localhost:5000
error: SUPERVISOR error Error: listen EADDRINUSE 127.0.0.1:5001
at Server.setupListenHandle [as _listen2] (net.js:1335:14)
at listenInCluster (net.js:1383:12)
at GetAddrInfoReqWrap.doListen [as callback] (net.js:1509:7)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:61:10)
error: supervisorPort (5001) is already in use
i functions: No HTTPS functions found. Use firebase functions:shell if you would like to emulate other types of functions.
For a complete debug log, find here.
However, this command works fine: firebase serve --only functions.
=== Serving from '/Users/evan/source/react-redux-todos'...
i functions: Preparing to emulate functions.
Warning: You're using Node.js v10.6.0 but Google Cloud Functions only supports v6.11.5.
i functions: No HTTPS functions found. Use firebase functions:shell if you would like to emulate other types of functions.
Since it says supervisorPort(5001) is already in use, I lsof -i:5001 and finds no process. I also shut down my laptop and restart, gets the same error.
I find the similar issue here, however didn't find the solution.
I still don't know the reason, but adding --port=9000 solves the problem. For example, firebase serve --only functions --port=9000. Credits to restPort (5001) is already in use #142.
I was having this same error after updating to macOS Mojave 10.14.1 (was fine with 10.14). error: supervisorPort (5001) is already in use and it led me down this rabbit hole of additional updates and configuration that eventually got it to work.
1 Update Node Packages
I updated these items to these versions (latest as of this writing)
firebase-functions: 2.1.0
firebase: 5.5.8
I deleted by node_modules folder and reinstalled all the packages.
2 Firestore Emulator Setup Required
Next time I attempted to serve, firebase gave me this error:
Setup required, please run: firebase setup:emulators:firestore
Because of the weird permissions issues I initially had with mac, I actually have to run
node_modules/.bin/firebase setup:emulators:firestore
3 Then.... Fix Java Runtime Issues
On my next serve attempt, I was presented with firestore: No Java runtime present, requesting install. Mac presents a popup leading to a page where you can "download java for mac". This isn't what you actually need. You really need the Java SE Development Kit which enables command line interface.
Then... You may get these errors the next time you try to serve.
error: restPort (5002) is already in use
error: SUPERVISOR error Error: listen EADDRINUSE 127.0.0.1:5001
at Object._errnoException (util.js:1022:11)
at _exceptionWithHostPort (util.js:1044:20)
at Server.setupListenHandle [as _listen2] (net.js:1351:14)
at listenInCluster (net.js:1392:12)
at GetAddrInfoReqWrap.doListen [as callback] (net.js:1501:7)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:97:10)
error: supervisorPort (5001) is already in use
But Firebase still ended up continuing to successfully serve somehow, despite these errors. And it still shows my app over http://localhost:5000.
Hope this helps!

Resources