I created a new Firebase project, upgraded to Blaze Plan and started playing around with an onCall
function. I have this below function
exports.createUsername = functions.https.onCall(async request => {
if (!request.auth)
throw new functions.https.HttpsError(
'unauthenticated',
'The request is not authorized!'
)
try {
await auth.setCustomUserClaims(request.auth.uid, {
userName: request.data.userName,
isArtist: true
})
return
} catch (ex) {
throw new functions.https.HttpsError(
'aborted',
'Could not set the username',
ex
)
}
})
When I try to deploy it using firebase deploy --only functions:helloWorld
, I get this error:
Could not create or update Cloud Run service createusername, Container
Healthcheck failed. Revision ‘createusername-00006-niw’ is not ready
and cannot serve traffic. The user-provided container failed to start
and listen on the port defined provided by the PORT=8080 environment
variable within the allocated timeout. This can happen when the
container port is misconfigured or if the timeout is too short. The
health check timeout can be extended.
This is the same with any custom function I write. What exactly am I missing here? Note that the functions work perfectly fine in the Firebase Emulator.
What am I doing wrong here?