Understanding Cloud Functions: Configuration settings (Firecasts)

Поделиться
HTML-код
  • Опубликовано: 5 июл 2024
  • In the last episode of Understanding Cloud Functions, @CodingDoug showed us how to enable retries on background functions and the importance of idempotence. In this episode, you will learn the configuration options available for your functions, and when it makes sense to change them. Check out the resource links below to find out more, and subscribe to the Firebase channel for the latest in mobile development.
    Modifying function configuration → bit.ly/2H5L2GS
    Python runtime → bit.ly/2TEW1g4
    Cloud Functions pricing → bit.ly/2EKO13J
    Google Cloud regions → bit.ly/2Hmp5m0
    Understanding Cloud Functions for Firebase Playlist → bit.ly/2HYqscw
    Firecasts playlist → bit.ly/2LfjL2z
    To keep up with the latest from Firebase, subscribe! → bit.ly/2KUciWJ
  • НаукаНаука

Комментарии • 37

  • @Joekay1956
    @Joekay1956 5 лет назад +6

    Doug you are awesome! Thanks for all the helpful videos. :)
    I am very excited about the video to cold start times

  • @robertshawnmitchell
    @robertshawnmitchell 5 лет назад +1

    Very helpful. Thanks Doug!

  • @guanacodevs
    @guanacodevs 5 лет назад +2

    I started with Firebase, with no idea what I was doing in GCP, whenever I had to do something(I say that like if I knew what I was doing in Firebase :-D :-D ). Now I feel very comfortable with GCP, Firebase made the transition to GCP very smooth and introduce me to the benefits to GCP. Now I'm refactoring most of my functions to Python because I feel is easier python than JavaScript. Even thogh Firebase deploy makes it really easy to deploy/update functions, once you get the hang of gcloud commands making your own scripts to execute different tasks make development more enjoyable.

    • @dougstevenson3769
      @dougstevenson3769 5 лет назад +1

      So glad to hear you're getting more comfortable in GCP. That is actually one of my team's goals.
      Scripting gcloud is pretty much the only way to go for functions deploys! Actually, at the end of December, I ended up making my own Python function deployer that made it work kind of like the Firebase CLI. It was a fun little project, I should probably finish it and open source it or something.

  • @pnkjjsr
    @pnkjjsr 4 года назад

    I got that problem today :) thanks 7th Jan 2020

  • @vibonacci
    @vibonacci 5 лет назад

    Does it make sense to change the region of cloud functions when these functions heavily use FB realtime database?

  • @ben6
    @ben6 4 года назад

    Node 13 is out and here we are with firebase functions running Node 10 on 'beta'. :D

  • @raghav4296
    @raghav4296 5 лет назад

    HI Doug, sorry if this question was answered before in the Firecasts - All functions are bundled in one index.ts file and it is good to have common modules imported as global variables.This is great for similar functions but if in case we have two different functions totally doing independent and memory consuming tasks(E.g:Audio processing,Image manipulation), what is the the recommended approach. Thanks!!

    • @dougstevenson3769
      @dougstevenson3769 5 лет назад +1

      It's best to minimize the amount of globals you use. That's part of the discussion in the next video, so be sure to watch when it's available soon.

    • @raghav4296
      @raghav4296 5 лет назад

      @@dougstevenson3769 Thank you Doug!!

  • @KanwarpartapSingh
    @KanwarpartapSingh 5 лет назад

    You may need to create a video on getDownloadURL. Which is deprecated in SDK 16.0.1. I can't understand how to replace previous code to the new code which is presented by you. Hope you understand.

  • @DenisTRUFFAUT
    @DenisTRUFFAUT 5 лет назад

    Is it a good strategy to duplicate a http function on multiple regions then let PWA choose the best region ? What about Firestore, is it multi-region (auto replicated in multiple regions ?)

    • @dougstevenson3769
      @dougstevenson3769 5 лет назад

      I've heard of people deploying HTTP functions to multiple regions for performance reasons, but I haven't heard of anyone running benchmarks to find out how effective it was for their use case. The functions themselves don't run any faster in different regions, and they might reach outside the region for data, which might make them run slower.
      You can read more about Firestore replication here (all I did was perform a search, since I don't know the details):
      groups.google.com/forum/#!topic/google-cloud-firestore-discuss/OlBQAFMdomY

  • @eliya.c
    @eliya.c 5 лет назад

    I have a case when after rtdb reference has been written, I need to check 30 minutes later about its state (a simple ">" clause statement). In theory, my approach would be to check - if the given statement is false, wait 5 minutes and re-trigger the event. If the given statement passes (or if the reference has been deleted), do something and delete the reference.
    My question is - if the function just "waits" for 5 minutes without doing anything special, will it be much more expensive?

    • @eliya.c
      @eliya.c 5 лет назад

      The case is when I want to notify user X that user Y has been disconnected for over 10 minutes (getting the connection state via real-time presence).

    • @dougstevenson3769
      @dougstevenson3769 5 лет назад

      Yes, you will pay for the 5 minutes it spent waiting. Having a function that just waits isn't really advisable if you can come up with another way to delay some work (such as using Cloud Tasks to schedule future work).

    • @guanacodevs
      @guanacodevs 5 лет назад

      I think the free tier gets you covered there "In addition to the 2 million invocations, the free tier provides 400,000 GB-seconds, 200,000 GHz-seconds of compute time". I'm listening for changes on an unreliable(in terms of schedule) site, listening every 30 seconds and re-triggering before the 9 minutes max timeout, and after 2 months listening sometimes up to 2 hours every day, I'm still under Free Tier. It might change though as my hunger for data increases.

  • @solasage7546
    @solasage7546 3 года назад

    Are Environment Configurations a safe way to hide third party API keys?

  • @aaronrs2002
    @aaronrs2002 Год назад

    I'm running node 16. my package .json says: "engines": {"node": "16"}
    Your advice gives me this fatal error:
    Deploys to runtimes below Node.js 10 are now disabled in the Firebase CLI. Existing Node.js 8 functions will stop executing at a future date. Update existing functions to Node.js 10 or greater as soon as possible.
    Firebase is not reading my package.json.

  • @theblackharted
    @theblackharted 5 лет назад +3

    lol hoping you'd address the cold start in this vid...really need optimization on that.

    • @dougstevenson3769
      @dougstevenson3769 5 лет назад +1

      Yeah, it's a complicated enough topic that it requires its own video (that is, with my strategy of keeping these all within 5-7 minutes). The way the Firebase CLI deploys functions adds a complication that can be difficult to work around.

  • @MindzGroupTech
    @MindzGroupTech 5 лет назад

    Will that memory configuration be effective while running the functions locally with firebase serve ... I am getting my function's emulation crashed every second request it processess and recovered automatically. And strangely this is happening only on one machine. Remaining development machines are not having this issue. Even they run fine on firebase itself. I have checked around and not able to find any reason this could happen. This machine in question is running Ubuntu 16.04 with 16GB ram and 2.5ghz i5 CPU. Using node 8.14.5 and latest firebase tools as of today. Engine is also set to v8 for functions. Please let me know in case you can help me figure this out.
    Other point to note is that my functions are divided into multiple smaller http functions based on the process and business logic. So it almost certain thay many functions getting invoked one by one (sequentially) by front-end to complete a business flow.

    • @dougstevenson3769
      @dougstevenson3769 5 лет назад

      I suspect the local emulator for Firebase doesn't have memory limits, since it's the same one provided by the Cloud platform. github.com/GoogleCloudPlatform/cloud-functions-emulator
      I suspect that you'll have to take a guess at how much memory is needed, and adjust for that. Perhaps looking at the size of the emulator process on the local machine might help, but I've never tried to do that before.

    • @MindzGroupTech
      @MindzGroupTech 5 лет назад

      @@dougstevenson3769 how and where i can find the logs for the functions getting crashed ... I know the functions crashes if they reach their memory limits and this has been told on some of the firebase video only. But the strange point is that is happening only in an ubuntu laptop ... Rest everywhere it is fine

    • @dougstevenson3769
      @dougstevenson3769 5 лет назад

      @@MindzGroupTech they should appear in the Firebase or Cloud console along with the other logs. Though, they will scroll away over time. If you're looking to collect historical data from logs, you might be interested in StackDriver to help see what went wrong.

    • @MindzGroupTech
      @MindzGroupTech 5 лет назад

      @@dougstevenson3769 i am talking about the local emulator ... The functions are running locally and crashing locally. I can only see the log in terminal stating function crashed ... Blah blah blah but no reason on what caused that.

    • @dougstevenson3769
      @dougstevenson3769 5 лет назад

      @@MindzGroupTech If it's not printed to the console, I don't think there's any more information available. Sorry. The emulator could be better, and there is effort under way to improve the local emulation experience for Cloud Functions, in addition to other Firebase products.

  • @rara737
    @rara737 5 лет назад

    is Cloud Functions working on Android??

  • @fredlllll
    @fredlllll 5 лет назад

    i have this in my package.json
    "engines": { "node": "8"
    }
    and guess what, the firebase cli still shows updating Node.js 6 function
    what did i do wrong?

    • @dougstevenson3769
      @dougstevenson3769 5 лет назад

      As I say in the video, it only applies to newly deployed functions. Delete the existing function and redeploy it if you want to change the runtime.

    • @fredlllll
      @fredlllll 5 лет назад

      @@dougstevenson3769 so there is no way to easily do this for all existing functions?

  • @Inzamamshakeel
    @Inzamamshakeel 2 года назад

    2:09

  • @dinoscheidt
    @dinoscheidt 5 лет назад

    Ehm... one other important reason for region selection is to get out of the US-Jurisdiction/NSA, no? European here 👋

    • @dougstevenson3769
      @dougstevenson3769 5 лет назад

      Yes, that could help with whatever restrictions you have to follow. But I'm not really well informed enough to know if selecting a region for Cloud Functions (if it's just a part of your processing) is necessary or sufficient for compliance with whatever rules are in place. GDPR in particular seems really challenging to me.

  • @radhakrishnanmuniswamy2364
    @radhakrishnanmuniswamy2364 5 лет назад

    Google calendar

  • @nibeditadas9202
    @nibeditadas9202 5 лет назад

    Google don't become like apple increasing price tag on your services all is left at low price to small developers is Google's services so nothing will be left if you become the next Apple or Microsoft.