I am trying to get the tutorial for firebase and cloud run to work following the instructions here.
In the firebase deploy step I keep getting a permission denied error, here is the error stack:
firebase deploy --debug
i deploying hosting
[2020-12-07T03:52:01.058Z] >>> HTTP REQUEST POST https://firebasehosting.googleapis.com/v1beta1/sites/nubonetics/versions
{"config":{"rewrites":[{"glob":"**","run":{"region":"us-central1","serviceId":"helloworld"}}]},"labels":{"deployment-tool":"cli-firebase"}}
[2020-12-07T03:52:01.524Z] <<< HTTP RESPONSE 403 {"vary":"X-Origin, Referer, Origin,Accept-Encoding","content-type":"application/json; charset=UTF-8","date":"Mon, 07 Dec 2020 03:52:01 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3-29=\":443\"; ma=2592000,h3-T051=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"","accept-ranges":"none","transfer-encoding":"chunked"}
[2020-12-07T03:52:01.525Z] <<< HTTP RESPONSE BODY {"error":{"code":403,"message":"The caller does not have permission","status":"PERMISSION_DENIED"}}
You probably need to set up your permissions on CloudRun.
Check out the "Before you begin" section of the following article:
https://cloud.google.com/cloud-build/docs/deploying-builds/deploy-cloud-run
Related
I am trying to set up firebase for a Flutter app. I have successfully logged in using the firebase cli. But when I run
flutterfire configure
I get the following error in the debug log:
[debug] [2022-03-05T10:44:24.286Z] ----------------------------------------------------------------------
[debug] [2022-03-05T10:44:24.287Z] Command: /usr/local/bin/firebase /home/madlad/.cache/firebase/tools/lib/node_modules/firebase-tools/lib/bin/firebase projects:list --json
[debug] [2022-03-05T10:44:24.287Z] CLI Version: 10.2.2
[debug] [2022-03-05T10:44:24.287Z] Platform: linux
[debug] [2022-03-05T10:44:24.287Z] Node Version: v12.18.1
[debug] [2022-03-05T10:44:24.287Z] Time: Sat Mar 05 2022 16:14:24 GMT+0530 (India Standard Time)
[debug] [2022-03-05T10:44:24.287Z] ----------------------------------------------------------------------
[debug]
[debug] [2022-03-05T10:44:24.291Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[debug] [2022-03-05T10:44:24.291Z] > authorizing via FIREBASE_TOKEN environment variable
[debug] [2022-03-05T10:44:24.293Z] > refreshing access token with scopes: []
[debug] [2022-03-05T10:44:24.293Z] >>> HTTP REQUEST POST https://www.googleapis.com/oauth2/v3/token
<request body omitted>
[debug] [2022-03-05T10:44:24.475Z] <<< HTTP RESPONSE 400 {"expires":"Mon, 01 Jan 1990 00:00:00 GMT","pragma":"no-cache","date":"Sat, 05 Mar 2022 10:44:24 GMT","cache-control":"no-cache, no-store, max-age=0, must-revalidate","content-type":"application/json; charset=utf-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","server":"scaffolding on HTTPServer2","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"","accept-ranges":"none","transfer-encoding":"chunked"}
[debug] [2022-03-05T10:44:24.484Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects pageSize=1000
[debug] [2022-03-05T10:44:24.722Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects 401
[debug] [2022-03-05T10:44:24.722Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects [omitted]
[debug] [2022-03-05T10:44:24.724Z] HTTP Error: 401, Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.
[debug] [2022-03-05T10:44:24.891Z] FirebaseError: HTTP Error: 401, Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.
at module.exports (/home/madlad/.cache/firebase/tools/lib/node_modules/firebase-tools/lib/responseToError.js:47:12)
at RetryOperation._fn (/home/madlad/.cache/firebase/tools/lib/node_modules/firebase-tools/lib/apiv2.js:286:39)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
[error]
[error] Error: Failed to list Firebase projects. See firebase-debug.log for more info.
The existing solutions say try logging out and logging in again or firebase login --reauth. I have tried both of them and none of them are working.
For some reason, I can't use the Flutterfire CLI to configure an ios app on firebase. I've done this before but this time I'm gettings this error
FirebaseCommandException: An error occured on the Firebase CLI when attempting to run a command.
COMMAND: firebase apps:create ios good_dreams (ios) --bundle-id=com.infatechnologies.good_dreams --json --project=good-dreams-app
ERROR: Failed to create iOS app for project good-dreams-app. See firebase-debug.log for more info.
I've tried going through the debug.log file to see what's wrong and I saw a post request with and error code of 401 as a response.
{
"error": {
"code": 401,
"message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
"status": "UNAUTHENTICATED",
"details": [
{
"#type": "type.googleapis.com/google.rpc.ErrorInfo",
"reason": "CREDENTIALS_MISSING",
"domain": "googleapis.com",
"metadata": {
"method": "google.firebase.service.v1beta1.IosAppService.ListIosApps",
"service": "firebase.googleapis.com"
}
}
]
}
}
What are these missing credentials? How do I get them? Here is the whole firebase-debug.log file:
[debug] [2022-02-15T15:41:11.658Z] ----------------------------------------------------------------------
[debug] [2022-02-15T15:41:11.660Z] Command: /usr/local/bin/firebase /Users/user/.cache/firebase/tools/lib/node_modules/firebase-tools/lib/bin/firebase apps:create ios good_dreams (ios) --bundle-id=com.infatechnologies.good_dreams --json --project=good-dreams-app
[debug] [2022-02-15T15:41:11.660Z] CLI Version: 10.0.1
[debug] [2022-02-15T15:41:11.660Z] Platform: darwin
[debug] [2022-02-15T15:41:11.660Z] Node Version: v12.18.1
[debug] [2022-02-15T15:41:11.661Z] Time: Tue Feb 15 2022 15:41:11 GMT+0000 (Greenwich Mean Time)
[debug] [2022-02-15T15:41:11.661Z] ----------------------------------------------------------------------
[debug]
[debug] [2022-02-15T15:41:11.708Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[debug] [2022-02-15T15:41:11.708Z] > authorizing via signed-in user (aduhenry9#gmail.com)
[info] Create your IOS app in project good-dreams-app:
[debug] [2022-02-15T15:41:11.712Z] >>> HTTP REQUEST POST https://firebase.googleapis.com/v1beta1/projects/good-dreams-app/iosApps
{"displayName":"good_dreams (ios)","bundleId":"com.infatechnologies.good_dreams"}
[debug] [2022-02-15T15:41:12.192Z] <<< HTTP RESPONSE 400 {"vary":"X-Origin, Referer, Origin,Accept-Encoding","content-type":"application/json; charset=UTF-8","date":"Tue, 15 Feb 2022 15:41:12 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"","accept-ranges":"none","transfer-encoding":"chunked"}
[debug] [2022-02-15T15:41:12.193Z] <<< HTTP RESPONSE BODY {"error":{"code":400,"message":"Request contains an invalid argument.","status":"INVALID_ARGUMENT"}}
[debug] [2022-02-15T15:41:12.194Z] HTTP Error: 400, Request contains an invalid argument.
[debug] [2022-02-15T15:41:12.689Z] FirebaseError: HTTP Error: 400, Request contains an invalid argument.
at module.exports (/Users/user/.cache/firebase/tools/lib/node_modules/firebase-tools/lib/responseToError.js:38:12)
at Request._callback (/Users/user/.cache/firebase/tools/lib/node_modules/firebase-tools/lib/api.js:41:35)
at Request.self.callback (/Users/user/.cache/firebase/tools/lib/node_modules/request/request.js:185:22)
at Request.emit (events.js:315:20)
at Request.EventEmitter.emit (domain.js:482:12)
at Request.<anonymous> (/Users/user/.cache/firebase/tools/lib/node_modules/request/request.js:1154:10)
at Request.emit (events.js:315:20)
at Request.EventEmitter.emit (domain.js:482:12)
at IncomingMessage.<anonymous> (/Users/user/.cache/firebase/tools/lib/node_modules/request/request.js:1076:12)
at Object.onceWrapper (events.js:421:28)
at IncomingMessage.emit (events.js:327:22)
at IncomingMessage.EventEmitter.emit (domain.js:482:12)
at endReadableNT (_stream_readable.js:1221:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
[error]
[error] Error: Failed to create iOS app for project good-dreams-app. See firebase-debug.log for more info.
to configure iOS:
flutterfire configure -icom.ios.bubdle
so add -i then your (ios) bundle id
from CLI Commands
I thought the bundle id (ios) and package name (android) should be the same, they should not. The organisation might be the same but what comes last should not. That was the issue although it's not stated in any guide/tutorials I could find, not even in the error messages
Aha! I've found the answer. So for some reason, apple doesn't allow underscore("_") in bundleId names, change your bundleId to not use underscore and you'd be good to go.
Let me know if this helps.
You can always try creating the IOS app manually via the Firebase Console (that's how I always do it).
I was tying to create firestore web app by following the link https://firebase.google.com/codelabs/firestore-web#3
I came to 3rd lesson and I stuck at the below npm code
I have used firebase use --add
to list the projects.
I got the below error as firebase-console.log
**[debug] [2021-03-04T08:25:39.308Z] ----------------------------------------------------------------------
[debug] [2021-03-04T08:25:39.312Z] Command: C:\Program Files\nodejs\node.exe C:\Users\BKRK\AppData\Roaming\npm\node_modules\firebase-tools\lib\bin\firebase.js use --add
[debug] [2021-03-04T08:25:39.312Z] CLI Version: 9.5.0
[debug] [2021-03-04T08:25:39.313Z] Platform: win32
[debug] [2021-03-04T08:25:39.313Z] Node Version: v12.18.0
[debug] [2021-03-04T08:25:39.315Z] Time: Thu Mar 04 2021 13:55:39 GMT+0530 (India Standard Time)
[debug] [2021-03-04T08:25:39.315Z] ----------------------------------------------------------------------
[debug] [2021-03-04T08:25:39.316Z]
[debug] [2021-03-04T08:25:39.328Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[debug] [2021-03-04T08:25:39.329Z] > authorizing via signed-in user
[debug] [2021-03-04T08:25:39.336Z] > refreshing access token with scopes: []
[debug] [2021-03-04T08:25:39.338Z] >>> HTTP REQUEST POST https://www.googleapis.com/oauth2/v3/token
<request body omitted>
[debug] [2021-03-04T08:25:42.275Z] <<< HTTP RESPONSE 400 {"expires":"Mon, 01 Jan 1990 00:00:00 GMT","date":"Thu, 04 Mar 2021 08:25:41 GMT","pragma":"no-cache","cache-control":"no-cache, no-store, max-age=0, must-revalidate","content-type":"application/json; charset=utf-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","server":"scaffolding on HTTPServer2","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3-29=\":443\"; ma=2592000,h3-T051=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"","accept-ranges":"none","transfer-encoding":"chunked"}
[debug] [2021-03-04T08:25:42.279Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects pageSize=1000
[debug] [2021-03-04T08:25:43.402Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects 401
[debug] [2021-03-04T08:25:43.403Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects [omitted]
[debug] [2021-03-04T08:25:43.403Z] HTTP Error: 401, Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.
[debug] [2021-03-04T08:25:44.116Z] FirebaseError: HTTP Error: 401, Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.
at module.exports (C:\Users\BKRK\AppData\Roaming\npm\node_modules\firebase-tools\lib\responseToError.js:38:12)
at Client.doRequest (C:\Users\BKRK\AppData\Roaming\npm\node_modules\firebase-tools\lib\apiv2.js:238:23)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Client.request (C:\Users\BKRK\AppData\Roaming\npm\node_modules\firebase-tools\lib\apiv2.js:96:20)
at async getProjectPage (C:\Users\BKRK\AppData\Roaming\npm\node_modules\firebase-tools\lib\management\projects.js:232:17)
at async getFirebaseProjectPage (C:\Users\BKRK\AppData\Roaming\npm\node_modules\firebase-tools\lib\management\projects.js:249:23)
at async listFirebaseProjects (C:\Users\BKRK\AppData\Roaming\npm\node_modules\firebase-tools\lib\management\projects.js:280:29)
[error]
[error] Error: Failed to list Firebase projects. See firebase-debug.log for more info.**
just type in the terminal
firebase login --reauth
should open the browser and log in to your account again, it worked for me.
I'm having a problem exporting the user account emails from Firebase.
I just revisited an old project I haven't touched in months and I'd like to export the email addresses. I'm in my functions folder, and have done:
npm install -g firebase-tools
then
npm install firebase-functions
and
npm install
No issues here. I then enter:
firebase auth:export save_file.csv --format=csv
and I get the output:
$ firebase auth:export save_file.csv --format=csv
Exporting accounts to save_file.csv
Error: An unexpected error has occurred.
I also read that you can try firebase login --interactive but when I do that I get the error:
Already logged in as ***#gmail.com
How should I go about debugging this/what should I be doing to export the emails? Any ideas?
Thank you.
Edit: I dug into the firebase-debug and the output showed:
[debug] [2020-01-20T21:49:31.847Z] ----------------------------------------------------------------------
[debug] [2020-01-20T21:49:31.849Z] Command: C:\Program Files\nodejs\node.exe C:\Users\Simon K\AppData\Roaming\npm\node_modules\firebase-tools\lib\bin\firebase.js auth:export save_file.csv --format=csv
[debug] [2020-01-20T21:49:31.849Z] CLI Version: 7.12.1
[debug] [2020-01-20T21:49:31.849Z] Platform: win32
[debug] [2020-01-20T21:49:31.849Z] Node Version: v12.7.0
[debug] [2020-01-20T21:49:31.851Z] Time: Mon Jan 20 2020 16:49:31 GMT-0500 (Eastern Standard Time)
[debug] [2020-01-20T21:49:31.851Z] ----------------------------------------------------------------------
[debug] [2020-01-20T21:49:31.851Z]
[debug] [2020-01-20T21:49:31.857Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[debug] [2020-01-20T21:49:31.858Z] > authorizing via signed-in user
[debug] [2020-01-20T21:49:31.859Z] [iam] checking project anonymous-social for permissions ["firebase.projects.get","firebaseauth.users.get"]
[debug] [2020-01-20T21:49:31.860Z] > refreshing access token with scopes: ["email","https://www.googleapis.com/auth/cloud-platform","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","openid"]
[debug] [2020-01-20T21:49:31.860Z] >>> HTTP REQUEST POST https://www.googleapis.com/oauth2/v3/token
<request body omitted>
[debug] [2020-01-20T21:49:32.050Z] <<< HTTP RESPONSE 400
[debug] [2020-01-20T21:49:32.051Z] >>> HTTP REQUEST POST https://cloudresourcemanager.googleapis.com/v1/projects/anonymous-social:testIamPermissions
[debug] [2020-01-20T21:49:32.183Z] <<< HTTP RESPONSE 401
[debug] [2020-01-20T21:49:32.183Z] <<< HTTP RESPONSE BODY
[debug] [2020-01-20T21:49:32.184Z] [iam] error while checking permissions, command may fail: FirebaseError: HTTP Error: 401, Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.
[info] Exporting accounts to save_file.csv
[debug] [2020-01-20T21:49:32.185Z] > refreshing access token with scopes: ["email","https://www.googleapis.com/auth/cloud-platform","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","openid"]
[debug] [2020-01-20T21:49:32.185Z] >>> HTTP REQUEST POST https://www.googleapis.com/oauth2/v3/token
<request body omitted>
[debug] [2020-01-20T21:49:32.332Z] <<< HTTP RESPONSE 400
[debug] [2020-01-20T21:49:32.333Z] >>> HTTP REQUEST POST https://www.googleapis.com/identitytoolkit/v3/relyingparty/downloadAccount
[debug] [2020-01-20T21:49:32.457Z] <<< HTTP RESPONSE 401
[debug] [2020-01-20T21:49:32.457Z] <<< HTTP RESPONSE BODY
[debug] [2020-01-20T21:49:32.614Z] TypeError: Cannot read property 'code' of undefined
at C:\Users\Simon K\AppData\Roaming\npm\node_modules\firebase-tools\lib\accountExporter.js:170:26
at processTicksAndRejections (internal/process/task_queues.js:85:5)
[error]
[error] Error: An unexpected error has occurred.
Does this make sense?
For anyone struggling with the same. I ended up having to logout and relogin to firebase. I think my token had expired or something like that.
firebase logout
firebase login --interactive
I had to login twice for some reason but it worked then!
Did you run firebase use --add?
Or, could you try any following commands?
firebase projects:list
firebase use project_id_or_alias
--project flag.(firebase auth:export save_file.csv --format=csv --project=project_id_or_alias)
See:
https://firebase.google.com/docs/cli
The command Firebase deploy always stucks when I run it.
Here is the verbose info:
$ firebase deploy --token "SOMETOKEN" --debug
----------------------------------------------------------------------
Command: /usr/local/bin/node /usr/local/bin/firebase deploy --token SOMETOKEN --debug
CLI Version: 3.0.0
Platform: darwin
Node Version: v5.0.0
Time: Tue May 24 2016 14:25:31 GMT+0800 (CST)
----------------------------------------------------------------------
> command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase"]
> refreshing access token with scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase"]
>>> HTTP REQUEST POST https://www.googleapis.com/oauth2/v3/token refresh_token=SOMETOKEN, client_id=XXXXXX-XXXXXX.apps.googleusercontent.com, client_secret=XXXXXX, grant_type=refresh_token, scope=email openid https://www.googleapis.com/auth/cloudplatformprojects.readonly https://www.googleapis.com/auth/firebase
<<< HTTP RESPONSE 200 cache-control=no-cache, no-store, max-age=0, must-revalidate, pragma=no-cache, expires=Mon, 01 Jan 1990 00:00:00 GMT, date=Tue, 24 May 2016 06:25:33 GMT, vary=X-Origin, Origin,Accept-Encoding, content-type=application/json; charset=UTF-8, x-content-type-options=nosniff, x-frame-options=SAMEORIGIN, x-xss-protection=1; mode=block, server=GSE, alternate-protocol=443:quic, alt-svc=quic=":443"; ma=2592000; v="34,33,32,31,30,29,28,27,26,25", accept-ranges=none, connection=close
>>> HTTP REQUEST GET https://admin.firebase.com/v1/projects/hackdaychat
<<< HTTP RESPONSE 200 server=nginx, date=Tue, 24 May 2016 06:25:34 GMT, content-type=application/json; charset=utf-8, content-length=109, connection=close, x-content-type-options=nosniff, strict-transport-security=max-age=31536000; includeSubdomains, cache-control=no-cache, no-store
>>> HTTP REQUEST GET https://admin.firebase.com/v1/database/hackdaychat/tokens
<<< HTTP RESPONSE 200 server=nginx, date=Tue, 24 May 2016 06:25:36 GMT, content-type=application/json; charset=utf-8, content-length=423, connection=close, x-content-type-options=nosniff, strict-transport-security=max-age=31536000; includeSubdomains, cache-control=no-cache, no-store
As you can see, I tried it with a token I have created before via firebase login:ci.
Without a token it is the same result.
I have also created the local Firebase project. There was no error during Firebase init.
Firebase --list works fine. FireBase login and Firebase logout works fine.
Some additional info:
$ node -v --> v5.0.0
$ npm -v --> 3.3.6
$ firebase -V --> 3.0.0
OS: OS X 10.11.4
Location: Shanghai, but using Proxy to Singapur.
Access to Firebase website works fine.
I have owner rights on the project I am using
I try to deploy some kind of empty project. Means: My public folder only contains index.html and 404.html.
Anyone got an idea what could go wrong?
I got similar problem
Try
firebase logout
then
firebase login
it's works on my case. Once i logged in it's seem firebase app required extra permissions
also
npm update -g firebase-tools
Same here
firebase login and logout work fine. Same with init.
Also tried with and without a token. Same result as described by Frank.
I am behind a corporate proxy.
node -v --> v4.4.2
firebase --version --> 3.0.1
npm -v --> 2.15.0