4 ms·
It sounds like you're committed to Lambda, but we've spent extensive time across both Lambdas and Google Cloud Functions, and my off the cuff, somewhat biased o
by kaishiro 5y ago
It sounds like you're committed to Lambda, but we've spent extensive time across both Lambdas and Google Cloud Functions, and my off the cuff, somewhat biased opinion is that GCF gives a significantly better development experience the Lambdas. I note biased because a majority of the work we do lives in RTDB/Firestore.
However, in response to your specific pain point - after initializing a new functions project you can immediately run an 'npm run serve' and have local execution firing for any scaffolded endpoints. These - by default - will connect to a project associated RTDB/Firestore instance without the need for additional service account/IAM configuration.
I've always enjoyed that this was a part of the mainline dev flow - and it removes a huge barrier of entry for me (mostly mental) to spin up little toy projects or test endpoints whenever the thought crosses my mind.
- wussboy 5y agoThis response surprises me. I find Google Cloud Functions to be orders of magnitude worse than Lambdas. Everything that you deal with in AWS with the added bonus that instead of taking 5 seconds to deploy it takes 5 minutes. I would love to know better options. How do you deal with that horrible deployment time?
- kaishiro 5y agoThe simple answer is we don't. I've never even considered deployment time as a base metric, and I guess it's equally surprising to me that that's an issue. The fact that we can do all of our testing locally means that we rarely have to do the "log and redeploy" dance that the OP was referring to.
- wussboy 5y agoRight. I definitely try and do as much testing locally as I can, but it still often takes me 10-20 updates to get everything working (missed an environment variable, permissions different in the cloud, blah blah blah). That’s usually a couple hours of my life i don’t get back.
- kaishiro 5y agoYeah, completely understand. I think the only issue we've run into that's forced us to go back to the trough with multiple re-deploys is very early on when we were negotiating better CORS patterns. Other than that, the fact that you can now fully simulate not only the GCF endpoints, but also all of RTDB and Firestore locally - and with a simple debug toggle to connect to stage/prod (insert safety disclaimer here) is a really powerful paradigm. Certainly not something you couldn't do similarly with Lambda/Dynamo/API Gateway using IAM roles or whatever - but it just feels very first class citizen with GC. Also, as an aside - I wouldn't normally try and convert someone from AWS => GC, because I think you can be equally effective in either. I only dropped my original response because the OP specifically called out local emulation being an issue.
- aceatgoogle 5y ago1) If you're using Google Cloud Functions, you might also want to check out the Running Functions Locally doc page. [1] (There's an NPM library [2] - @google-cloud/functions-framework - that handles the scaffolding for you.) Note that this library only supports scaffolding one function at a time per process - so you'd have to create a separate process [and use a separate port] for each function you're using. (This includes event-based functions - everything is HTTP under the hood, and this library is no different.) 2) Deployment time - you're definitely not the first to bring this up. :) We're working internally on improving deployment times. (Disclosure - per my username, I work at GCP.) [1] https://cloud.google.com/functions/docs/running/function-frameworks https://cloud.google.com/functions/docs/running/function-fra... [2] https://www.npmjs.com/package/@google-cloud/functions-framework https://www.npmjs.com/package/@google-cloud/functions-framew...
- wussboy 5y agoI appreciate this comment. I spent 4 hours updating-deploy-test-repeat with GCP last night trying to track down a couple of niggling errors and it was a nightmare. I'd have killed to be able to step through it just once with a debugger and everything would have been fixed.
- deleted 5y ago[deleted]