firebase-tools: Firebase CLI deploy functions HTTP Error: 404 Not Found

Version info

6.2.2

Platform Information

Windows,

Steps to reproduce

firebase deploy --only functions

=== Deploying to 'vagtplan-1e00d'...

i  deploying functions
Running command: npm --prefix "functions" run lint

> functions@ lint C:\Users\srenb\Documents\Arbejde\skemadoktor.dk\cfunctions\functions
> tslint --project tsconfig.json

Running command: npm --prefix "functions" run build

> functions@ build C:\Users\srenb\Documents\Arbejde\skemadoktor.dk\cfunctions\functions
> tsc

+  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...
i  functions: packaged functions (48.09 KB) for uploading
!  functions: Upload Error: HTTP Error: 404, Not Found

Error: HTTP Error: 404, Not Found

Debug shows that it cannot find the required bucket:

Error: HTTP Error: 404, Not Found
[2019-01-15T11:17:12.995Z] Error Context: {
  "body": {
    "error": {
      "message": "Not Found"
    }
  },
  "response": {
    "statusCode": 404,
    "body": "<?xml version='1.0' encoding='UTF-8'?><Error><Code>NoSuchBucket</Code><Message>The specified bucket does not exist.</Message></Error>",

Expected behavior

It should upload no problem

Actual behavior

Fails because it can’t find the bucket returned from

 HTTP REQUEST POST https://cloudfunctions.googleapis.com/v1/projects/vagtplan-1e00d/locations/us-central1/functions:generateUploadUrl

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 2
  • Comments: 26 (3 by maintainers)

Most upvoted comments

I came across this same error and resolved it by making sure the site name in Firebase matched what I had in my firebase.json file.

Screen Shot 2020-03-19 at 6 42 03 PM

Screen Shot 2020-03-19 at 6 41 10 PM

This error looks project-specific. Please reach out to Firebase support for help, as the issue likely lies with the backend servers and not the Firebase CLI.

Thanks!

It was npm i -g firebase-tools which resolved the issue for me. It updated my old firebase tools. Hope this helps to someone.

Ideally, the site names shouldn’t be added to firebase.json. If you use different Firebase projects for staging and production (as recommended by Firebase), having the site names hardcoded in firebase.json poses a problem when you switch between projects with firebase use <projectName>. Site names are unique across projects; no matter which project you use, deploys will be made to the same Firebase site.

Instead, set up deploy targets in .firebaserc. Here’s an example of an app that has two Firebase projects (dev and prod), with two sites:

.firebaserc:

{
  "projects": {
    "dev": "myapp-staging", // alias "dev" to the project "myapp-staging"
    "prod": "myapp-prod"  // alias "prod" to the project "myapp-prod"
  },
  "targets": {
    "myapp-staging": { // project ID
      "hosting": {
        "adminpanel": [ // user-defined identifier for the Hosting site, call it whatever you'd like
          "myapp-staging-adminpanel" // name of the Hosting site as listed in your Firebase project
        ],
        "catalog": [
          "myapp-staging-catalog"
        ]
      }
    }
  }
}

firebase.json:

{
  "hosting": [
    {
      "target": "adminpanel",
      "public": "adminpanel-app/dist",
    },
    {
      "target": "catalog",
      "public": "catalog-app/dist"
    }
  ]
}

This way you can switch between, and deploy to, different Firebase projects without having to change your firebase.json.

firebase use dev
firebase deploy --only hosting:adminpanel

firebase use prod
firebase deploy --only hosting:adminpanel

@mbleigh Was this project-specific? I am running into the same issue. ? Opened a case (2-2819000025743) as recommended by you, but could be a mistake that I am making?

For me, this was resolved by setting the “Default GCP resource location” under Project settings.

Firebase doesn’t accept groups name with white spaces. e.g:- iOS

enter image description here

iOS SIT Tester always get failed on

Error: failed to distribute to testers/groups: HTTP Error: 404, Requested entity was not found.

wheres JinglePayTesters succeed without any problem.

    # Deploy on Firebase 
  - task: Bash@3
    displayName: "Upload to firebase app distribution"
    inputs:
      targetType: "inline"
      script: |
          npm i -g firebase-tools
          ls -la $(Build.BinariesDirectory)/output/
          firebase appdistribution:distribute  *.ipa \
            --app "$(app_id)" \
            --token "$(firebasetoken)" \
            --groups "JinglePayTesters" \
            --release-notes "From Azure Devops" \
            --debug	\
      workingDirectory: '$(Build.BinariesDirectory)/output/'

update your Firebase npm package to latest version . I works for me https://www.npmjs.com/package/firebase

For me updating the firebase-tools package from version 6.12 to the latest one (8.9) fixed this problem.

If you add a new target to firebaserc file, make sure you add the same site in the firebase hosting @ firebase console too.