Challenge - 5 Problems
Authentication Trigger Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ query_result
intermediate2:00remaining
What is the output of this Firebase Authentication trigger function?
Consider this Firebase Cloud Function that triggers when a user is created. What will be logged when a new user with email 'user@example.com' is created?
Firebase
exports.userCreated = functions.auth.user().onCreate((user) => {
console.log(`New user created: ${user.email}`);
return null;
});Attempts:
2 left
💡 Hint
The user object passed to the trigger contains the user's email property.
✗ Incorrect
The onCreate trigger receives a user object with properties including email. Logging user.email prints the new user's email.
🧠 Conceptual
intermediate1:30remaining
Which Firebase Authentication trigger runs when a user deletes their account?
Firebase Authentication provides triggers for user lifecycle events. Which trigger function runs when a user deletes their account?
Attempts:
2 left
💡 Hint
The trigger name includes 'Delete' for account deletion.
✗ Incorrect
The onDelete() trigger runs when a user account is deleted in Firebase Authentication.
📝 Syntax
advanced2:30remaining
Identify the syntax error in this Firebase Authentication trigger function
Which option contains the correct syntax for a Firebase Authentication onCreate trigger function?
Firebase
exports.newUser = functions.auth.user().onCreate((user) => {
console.log('User created:', user.uid);
return null;
});Attempts:
2 left
💡 Hint
Check for missing semicolons and balanced brackets.
✗ Incorrect
Option D has correct arrow function syntax, balanced braces, and semicolons. Others have missing semicolon or brace.
❓ optimization
advanced2:00remaining
How to optimize a Firebase Authentication onCreate trigger to minimize cold start time?
You want your Firebase Authentication onCreate trigger to run quickly when a user signs up. Which practice helps reduce cold start delays?
Attempts:
2 left
💡 Hint
Cold start is affected by how much code loads before the function runs.
✗ Incorrect
Initializing heavy libraries globally allows Firebase to reuse the instance, reducing cold start time.
🔧 Debug
expert3:00remaining
Why does this Firebase Authentication onDelete trigger fail to run?
Given this code, why does the onDelete trigger not execute when a user deletes their account?
exports.userDeleted = functions.auth.user().onDelete((user) => {
console.log('User deleted:', user.uid);
return null;
});
Attempts:
2 left
💡 Hint
Check if the function is active in your Firebase project.
✗ Incorrect
If the function is not deployed, it won't run even if the code is correct.