Firebase Deploy - "Unable to Authorize" error - javascript

I tried to deploy a very simple site for a Firebase project I have set up, and followed the following steps:
firebase login (I was already logged in since I have other projects I'm working on)
firebase init (created the .firebaserc and database.rules.json files).
firebase deploy
On deploy, I keep getting the following error message:
λ firebase deploy
! Your CLI authentication needs to be updated to take advantage of
new features.
! Please run firebase login --reauth
Error: Unable to authorize access to project [PROJECT NAME]
I succesfully ran firebase login --reauth and I still get this.
Anyone know what I could be doing wrong here?

First warning shows you have to update firebase-cli.
Run this command to update:
npm install -g firebase-tools
Your project may not have been linked which causes that error.
Run this command to link the project:
firebase use --add
It will list down the projects in your firebase account, select the correct one and try deploying the project using:
firebase deploy
PS: You don't have to append project_id to deploy command every time once you run use --add command

Found my answer in another post
It seems that when deploying, you're supposed to deploy with:
firebase deploy --project [PROJECT ID, not PROJECT NAME]

Related

Gatsby development server stops working when repo is created on github. Sanity, Gatsby Error

I received a github repo backup from somebody elses account. The project is running gatsby, sanity cms and is hosted via netlify. When I extract the archive and saving the folder locally, I am perfectly able to get the gatsby development server runnning just by doing "yarn install" and "yarn gatsby develop".
However, when I create a new repo and import the project to my github account, the development server is not running anymore. We tried it on several machines and we always get the same error in terminal trying "yarn gatsby develop".
success open and validate gatsby-configs - 0.131s
success load plugins - 2.486s
success onPreInit - 0.038s
success initialize cache - 0.009s
success copy gatsby files - 0.091s
info [sanity] Fetching remote GraphQL schema
ERROR #gatsby-source-sanity_drafts.10003
[sanity] The token specified is not valid or has been deleted
How is that possible? I tried to fix this for days but I don't get it. The only differnce between being able to run the dev server and this error is to save the code to github... Is it maybe some sort of routing problem in the gatsby-config.js?
Would appreciate your help a lot!
It seems that you are missing the environment variables in your new projects so your Sanity configuration is not valid, hence Gatsby is not able to fetch the data from the sources.
There should be a .env.development or .env.production files in your original code placed in the root of the project.

How to deploy create-react-app with typescript to Netlify when page returns 404

My Netlify hosted app keeps returning a 404 "Page Not Found". I've ran things as simply as I can:
I've followed the instructions on
https://create-react-app.dev/docs/getting-started/ and am
successfully running the react app on localhost.
I've created an app on netlify and successfully connected to my
github repository.
When I click "Trigger Deploy" on Netlify, everything runs
successfully.
When I try to open the hosted app I get a 404 "Page Not Found"
https://simple-cors-react.netlify.app/
Finally got it working by changing my deploy settings. I changed:
Build command: CI= yarn run build
Publish directory: ./build
(I get this error in the deploy log:
10:30:26 AM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'build' versus './build' in the Netlify UI
Which begs the question "why didn't you just work before if it was already in the netlify configuration file?")

Error: EPERM: operation not permitted, stat

I recently started using Firebase Functions for my Flutter project.
I saw that there is a code generator (firebase_functions_interop) that will transform your Dart code to Javascript code. This enables you to develop your cloud functions in Dart which is pretty nice.
But after developing my first cloud function and trying to deploy it to Firebase with the Firebase CLI, I constantly get the following error message:
Error: EPERM: operation not permitted, stat 'C:\PATH_TO_MY_FIREBASE_PROJECT\build\node\packages'
I'm new to npm & Firebase Functions so maybe I'm doing something fundamentally wrong.
It looks like something about permissions maybe? I don't know. But I also have full permissions on my workspace folder & have enabled VSCode as an Administrator
I have already tried to clean my npm cache & reinstalling my npm version.
Let me know if you need me to post anything else.
make sure you do not have the firebase emulator running! it will cause this error when trying to do a deployment to the firebase cloud.

Fire-base Cloud Function deploy completed without any error, but Cloud Function doesn't exist in Firebase

I have a problem that when I deploy JavaScript Cloud Function, it says deploy completed, but when I go to Firebase and check it is just not there. Strange thing is that for TypeScript Cloud Function it works properly.
I did everything the whole preparation like installing firebase-tools etc. by original Firebase video tutorial. I tried to deploy only uncommented hello world function but same results.
I also tried many times to reinit Firebase or even reinstall node and Firebase tools but still the same. Emulating locally doesn't work either you can see in the screenshot.
I will attach screenshot of index.js with project structure on left, firebase.json, deploy and emulate messages in cmd.
index.js:
firebase.json:
deploy in cmd:
emulate in cmd:
EDIT:
when i deployed with specified function this came up:
deploy with specified function:
When i deployed with empty firebase.json this:
deploy with empty firebase.json:
deploy with firebase.json as advised under:
Sorry for posting pictures, but code doesnt format for me right.
You are not really deploying your function.
See, whenever you deploy a new function, the CLI will show the following message.
=== Deploying to '<PROJECT-ID>'...
i deploying functions
i functions: ensuring necessary APIs are enabled...
✔ functions: all necessary APIs are enabled
i functions: preparing functions directory for uploading...
i functions: packaged functions (26.61 KB) for uploading
✔ functions: functions folder uploaded successfully
i functions: creating Node.js 8 function <FUNCTION-NAME>(us-central1)...
✔ functions[<FUNCTION-NAME>(us-central1)]: Successful create operation.
Function URL (<FUNCTION-NAME>): https://us-central1-<PROJECT-ID>.cloudfunctions.net/<FUNCTION-NAME>
✔ Deploy complete!
Project Console: https://console.firebase.google.com/project/<PROJECT-ID>/overview
In your screenshot, you are not getting the Successful message.
Can you please try deploying your functions with an empty json as the firebase.json file?
Be sure to run firebase deploy --only functions:<FUNCTION_NAME> in the project's root folder. That way, you are telling the CLI to deploy an specific function, in this case it'd be helloWorld.
If you don't see the Successful message again, post here the results to try to make it work.
Edit.
Try changing your firebase.json to
{
"functions":{
"source": "functions/",
"predeploy": [
"npm --prefix \"$RESOURCE_DIR\" run lint",
"npm --prefix \"$RESOURCE_DIR\" run build"
]
}
}
and then deploy again.

Parse.com To Do web app deployment issue

Apologies for basic question. I am very new in web development . I have download parse.com javascript web To Do App from https://parse.com/tutorials/todo-app-with-javascript . Now I want to deploy with parse.com. So that I can browse this app using http://mytestapp.parseapp.com. But when try to deploy using "parse deploy" command getting error as "Command must be run in a directory containing a Parse project."
Can you please help out me by step by step process.
Did you follow deployment rule of parse?
If your directory structure (from where you run command) is not as below you'll get the same error:
-config/
global.json
-cloud/
main.js
-public/
index.html
If the keys config/global.json do not matches to yours then also you'll error.

Categories