Get code from firebase console which I deployed earlier

17,444

Solution 1

Note: the process below may work or not for your case. Don't rely on it as a replacement for keeping your code in a proper version control system.

You can retrieve the code for your Cloud Functions from the Cloud Console.

  1. Go to this URL
  2. Select the project that the function is in
  3. Select a function from the list
  4. You will get to this page: Source tab of Google Cloud Functions

  5. Select the Source at the top

  6. Click the "Source location" link

A zip file with the latest source of your function will start to download.

Note that these files may periodically get deleted. In that case, the above process will not work to recover your source code.

Solution 2

When you click to select your project, make sure you have the right organization selected.

Select Organization

Solution 3

In the firebase console in the left hand menu select Functions. Hover over the function you want to view and click the three vertical dots. Select Detailed Usage Stats. This will bring you to the Google Cloud console. Select 'Source' to get the source code.

Share:
17,444
Abhilasha
Author by

Abhilasha

Updated on June 06, 2022

Comments

  • Abhilasha
    Abhilasha about 2 years

    I had created firebase functions in nodejs and deployed the code on firebase. The function was to send an email when the new user is created. I have lost the code now. Can we pull that code from firebase ?

  • Abhilasha
    Abhilasha about 7 years
    I am getting 404 after clicking on that link. On the page you added above inside code preview section I am getting this message : Archive not found in the storage location
  • Abhilasha
    Abhilasha about 7 years
    I had deployed it using firebase deploy command from my local machine
  • Frank van Puffelen
    Frank van Puffelen about 7 years
    Hmm... in that case the functions source might have been deleted from the Cloud servers too.
  • kodi
    kodi over 6 years
    If you are a collaborator on a project, it might not show up in the GCP dashboard. If you go to the Firebase dashboard, go to the functions directory, and go to one of the functions, off to the right there's a vertical ellipsis that only appears when you hover over it. Click that, and select "Detailed Usage Stats" - that will take you to the GCP dashboard for the project, and then you can follow these instructions.
  • Matt
    Matt about 6 years
    Where can I see firebase-functions-source file?
  • deepelement
    deepelement over 5 years
    Rule #1 for building a platform: Assume git reset --hard will happen waylessly
  • MQLN
    MQLN over 5 years
    Lifesaver for my own incompetence.
  • AFMeirelles
    AFMeirelles over 4 years
    You saved my day. Thanks.
  • C-lio Garcia
    C-lio Garcia about 3 years
    You definitely saved my day... my project... my everything