You write a Firebase Cloud Function and deploy it using firebase deploy --only functions. The function code contains a syntax error. What will be the result?
exports.helloWorld = functions.https.onRequest((req, res) => { res.send('Hello World'); }); // missing closing parenthesis fixedThink about what happens if code cannot be parsed correctly before deployment.
If the function code has a syntax error, the deployment process detects it and stops. The error message will show the syntax problem. The function will not be deployed until the error is fixed.
You have three Firebase functions in your project. You want to deploy only two of them without affecting the third. Which command should you use?
Check the syntax for deploying specific functions using the Firebase CLI.
The correct syntax to deploy specific functions is to use --only functions:functionName separated by commas. This deploys only the listed functions without affecting others.
You want to store API keys securely for your Firebase functions. Which method ensures the keys are not exposed in your code or public repositories?
Think about how to keep secrets out of source code and public repos.
Firebase provides a secure way to store environment variables using firebase functions:config:set. These variables are encrypted and not included in source code or public repos.
You notice your Firebase functions have slow response times on the first request after deployment or inactivity. What is a recommended approach to reduce this cold start delay?
Think about what causes cold start delays in serverless functions.
Cold starts happen when the function environment initializes. Keeping functions small and avoiding heavy setup outside the handler reduces initialization time and cold start latency.
maxInstances in Firebase function deployment?You configure a Firebase function with maxInstances: 2. What behavior does this setting enforce?
exports.limitedFunction = functions.runWith({ maxInstances: 2 }).https.onRequest((req, res) => { res.send('Hello'); });Consider what maxInstances controls in serverless scaling.
The maxInstances setting limits the maximum number of function instances that can run at the same time. This helps control resource usage and cost by preventing too many instances from spinning up.