Firebase deploy error

Trying to deploy a Firebase app with cloud functions and getting an error:
Deploying to Firebase…
Error: HTTP Error: 404, Method not found.
Please try again. If problem persists please post on https://support.glitch.com

Can’t understand what does it mean. https://glitch.com/edit/#!/firebase-blank.

1 Like

I tried it myself and got the same issue, I’m bringing it up with the team. If may be related to this since with this app you have two package.jsons:

2 Likes

Yeah, initially I had two issues:
Deploying to Firebase…
Please use pnpm instead of npm. /opt/nvm/versions/node/v8/bin/npm: line 16: /pnpm/bin/pnpm: No such file or directory
Error: HTTP Error: 404, Method
not found.

First one I fixed by enabling npm (enable-npm).

Hi,

Were you able to get it working? I was also able to fix the first issue by enabling npm, but also get the 404 error after.

So, I haven’t been able to deploy Firebase Functions via the “Deploy to Firebase” button, but it’s possible to deploy from the console (by running “firebase use” to select a Firebase project then “firebase deploy”).

The only issue is that “firebase login” isn’t working so you need to retrieve an access token first and then use the --token flag in your commands.

Hi @RomainVialard, welcome to the Glitch Forums!

Sorry you’ve been having difficulty getting things working with Firebase. We’ll take a closer look on Monday and see what’s up and if we can clarify things at all.

Thanks!
I would love to be able to deploy Firebase Functions from the “Deploy to Firebase” button.

But it’s already quite nice to be able to do it from Glitch, via the console.
(and actually instead of using the --token flag, better to start with the “firebase login --no-localhost” command in the console)

1 Like

Hi @RomainVialard sorry for the delay here - there was a bug in the Deploy to Firebase button that we fixed earlier in the week. Perhaps you’d like to give it another try? We’re still seeing some intermittent oddities, but I’d be interested to know if it works for you.

@cori I tested again and it is still not working.

Note that the issue happens specifically if your project contains Firebase functions, like in that case:
https://glitch.com/edit/#!/remix/gplus-exporter-with-full-text-search
If you click on the Deploy to Firebase button, it will throw the error “HTTP Error: 404, Method not found.”

Currently, if your project only contains Firebase Hosting files + Database rules, it will deploy them without issues (which makes me assume you are using Firebase CLI to deploy and not just the new Hosting API).
The issue only happens if you have Firebase functions to deploy. Best would be to allow us to deploy everything from the button (exactly like when running “firebase deploy” via the Firebase CLI) but if that’s not possible, second best would be to only deploy to Firebase Hosting (+ database rules) without throwing the “HTTP Error: 404, Method not found.” error.

Hi @RomainVialard thanks for the clarification; I missed that you were talking about Firebase Functions when you first mentioned it.

You are correct; we do use the Firebase Tools CLI on the backend, and we are connecting to Firebase Hosting for the deploy. The current Firebase tools are intentionally simple to introduce some basic Firebase possibilities, and at this point we don’t have any concrete plans to add additional features. If this is something that you’re interested in us tackling (and it sounds like it is) I encourage you to post a topic in https://support.glitch.com/c/feature-ideas.

1 Like

@cori understood, I added this feature request:

It would be great to fix the current bug though: if your Glitch project contains code for a Firebase function, you cannot even deploy to Firebase Hosting, the “Deploy to Firebase” button doesn’t work at all.

1 Like

Thanks, @RomainVialard, I suspect that’s a separate issue, probably the one discussed in Firebase- Deploying Firebase returns error. When you click on the Deploy to Firebase button, after signing in, are you presented with a list of projects to choose from? If not then you’re seeing that same issue, and we’re working with Google to figure out what’s going on with that.

@cori no, not related to the issue you linked. The issue only happens if you have a functions folder in your Glitch project and specifically a package.json file in that folder (different from the standard package.json file that can be found at the root of any Glitch project).
If I rename / remove this firebase-functions-specific package.json file, the “Deploy to Firebase” runs smoothly. If I keep it, it throws the “HTTP Error: 404, Method not found.” error (which I suppose is a generic error not related with what is really happening).

I suppose that when we click on the “Deploy to Firebase” button, behind the scene you are simply doing a “firebase deploy” via the Firebase CLI but at that moment, it reads the functions folder and try to do something that doesn’t work with the package.json file (eg: install npm dependencies).

Thanks for checking and clarifying! We’ll take a look, although I’m not sure when we plan more work on the Firebase features.