我跟这个很亲密.
我编写了一个Cloud Function,它将从Azure令牌发送的信息转换为自定义的Firebase令牌并将此令牌发送回客户端.
令牌已正确创建,但不会在我的HTTP请求中返回.
很遗憾,我的Firebase应用会导致超时.
函数执行花了60002毫秒,完成状态:'超时'
我无法真正理解为什么会这样,因此这篇文章.我的代码有问题,还是我调用HTTP请求错了?
这是我从Firebase Functions控制台获得的日志.
这是我的代码
// Create a Firebase token from any UID
exports.createFirebaseToken = functions.https.onRequest((req, res) => {
// The UID and other things we'll assign to the user.
const uid = req.body.uid;
const additionalClaims = {
name: req.body.name,
email: req.body.email
};
// Create or update the user account.
const userCreationTask = admin.auth().updateUser(uid, additionalClaims).catch(error => {
// If user does not exists we create it.
if (error.code === 'auth/user-not-found') {
console.log(`Created user …Run Code Online (Sandbox Code Playgroud) HTTPS函数应该像实时函数一样返回异步承诺吗?我们还没有在HTTPS函数中返回(只使用res.status.send等),而且看起来firebase/function-samples也不是.但文档略显含糊不清https://firebase.google.com/docs/functions/terminate-functions.