我刚刚为我的 iOS App 和 Firebase Cloud Functions 启用了 AppCheck。在 Firebase 函数日志中,当我尝试 HTTPS 调用函数时收到此消息:
Failed to validate AppCheck token. Error: Cannot validate AppCheck token. Please update Firebase Admin SDK to >= v9.8.0
at checkTokens (/workspace/node_modules/firebase-functions/lib/providers/https.js:255:23)
at func (/workspace/node_modules/firebase-functions/lib/providers/https.js:323:39)
at /workspace/node_modules/firebase-functions/lib/providers/https.js:356:44
at cors (/workspace/node_modules/cors/lib/index.js:188:7)
at /workspace/node_modules/cors/lib/index.js:224:17
at originCallback (/workspace/node_modules/cors/lib/index.js:214:15)
at /workspace/node_modules/cors/lib/index.js:219:13
at optionsCallback (/workspace/node_modules/cors/lib/index.js:199:9)
at corsMiddleware (/workspace/node_modules/cors/lib/index.js:204:7)
at corsFunc (/workspace/node_modules/firebase-functions/lib/providers/https.js:356:16)
Callable request verification failed: AppCheck token was rejected. {"verifications":{"app":"INVALID","auth":"VALID"}}
但是,我已经使用 npm 命令更新了 Admin SDK,并多次部署了我的函数和整个 firebase 文件夹。Admin SDK 似乎是最新的。
这是我的 Firebase 函数的 Typescript 文件的顶部的样子:
import * as functions from 'firebase-functions';
import * as admin from "firebase-admin";
import QuerySnapshot = admin.firestore.QuerySnapshot;
import { QueryDocumentSnapshot } from "firebase-functions/lib/providers/firestore";
我没有做些什么来使更新的 Admin SDK 生效吗?