4

A teammate deployed a Firebase cloud function to a shared account to which I have access. The source code isn't available to me yet, so I'm wondering if it's possible to read the source of a deployed cloud function (e.g. when logged into an account that has access to the Firebase console).

Does anyone know if this is possible? If so, any pointers on how one can read the source code of a deployed Firebase function would be hugely helpful!

duhaime
  • 25,611
  • 17
  • 169
  • 224

2 Answers2

4

If you have access to the Google Cloud console, you can access and download the source code there. You won't have the full benefit of having something like git access, but you can at least download a zip of the functions and see what's in production.

I'm Joe Too
  • 5,468
  • 1
  • 17
  • 29
  • Awesome, thanks very much! Do you know where in the console I can find the function source? – duhaime Jan 21 '20 at 02:17
  • Yep - just look for Google Cloud Functions under any project in there. You can click into any function and download the source. – I'm Joe Too Jan 21 '20 at 02:18
  • Bizarre, I've clicked function, trigger, region, runtime, memory, and timeout (all listed attributes of my function) and none displays the function source. Am I looking in the wrong place? I'm in https://console.firebase.google.com/u/1/project/millet-for-all/functions/list – duhaime Jan 21 '20 at 02:38
  • 1
    https://console.cloud.google.com/functions/list?project={yourProjectId} should list all of the deployed functions. If you click on any one of the functions, you should see "General", "Trigger", "Source" and "Testing". Clicking into "Source" gives an option to download the zip. Unless you don't have permissions in the project to see the source. You'd have to speak to the project admin to see if you have the proper permissions, but that's where you'd go for it. – I'm Joe Too Jan 21 '20 at 02:41
  • Strange, that route just shows the "Create a function" that I saw when checking the url @imjared posted – duhaime Jan 21 '20 at 11:53
3

You can find the source of your functions that are < 512kb in the cloud console control panel here: https://console.cloud.google.com/functions/list?tab=source

imjared
  • 19,492
  • 4
  • 49
  • 72