我正在使用带有 Firebase 函数的打字稿。当我尝试使用npm run deploy内部函数目录进行部署时。它抛出太多打字稿错误。
../../../../node_modules/@types/react/index.d.ts:3208:13 - error TS2717: Subsequent property declarations must have the same type. Property 'feFuncB' must be of type 'SVGProps<SVGFEFuncBElement>', but here has type 'SVGProps<SVGFEFuncBElement>'.
3208 feFuncB: React.SVGProps<SVGFEFuncBElement>;
~~~~~~~
../node_modules/@types/react/index.d.ts:3108:13
3108 feFuncB: React.SVGProps<SVGFEFuncBElement>;
~~~~~~~
'feFuncB' was also declared here.
../../../../node_modules/@types/react/index.d.ts:3209:13 - error TS2717: Subsequent property declarations must have the same type. Property 'feFuncG' must be of type 'SVGProps<SVGFEFuncGElement>', but here has type 'SVGProps<SVGFEFuncGElement>'.
3209 feFuncG: React.SVGProps<SVGFEFuncGElement>;
~~~~~~~
../node_modules/@types/react/index.d.ts:3109:13
3109 feFuncG: React.SVGProps<SVGFEFuncGElement>;
~~~~~~~
'feFuncG' was …Run Code Online (Sandbox Code Playgroud) 我正在从我的应用程序调用一个函数,该函数向应用程序上的特定用户发送通知。大部分时间通知都会成功发送,但很多时候不会发送。当它没有被发送时,我检查日志以查看
函数执行耗时 60003 毫秒,完成状态为:'timeout'
我试过玩我的承诺/异步等待,但没有运气,因为我怀疑这就是问题所在。
这是我的云代码现在的样子
exports.sendNotification = functions.https.onRequest(async (request, response) => {
if (request.method !== "POST") {
response.status(400).send("Send it using post request");
return;
}
var toUid = request.body.toUid
var fcm = request.body.fcm
var fromUid = request.body.fromUid
var type = request.body.type
var fromName = request.body.fromName
var messageText = request.body.message
if (toUid === "" || fromUid === "" || fcm === "") {
response.status(400).send("Parameter is missing!");
return;
}
// common data for both platforms
const notification = {
title: fromName,
body: …Run Code Online (Sandbox Code Playgroud) 我正在学习 Firestore 并构建了一个有角度的应用程序。我正在使用 Firebase 身份验证,但无法确定用于允许用户访问其数据的规则。例如,一个产品集合,每个产品都有一个 userId,实际上是他们的电子邮件地址。
我当前的规则如下,但不起作用(我已经尝试了基于文档、stackoverflow 等所能想到的一切):
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /users/{userEmail} {
allow read, write: if request.auth != null;
}
match /products/{userId}{
allow read, write: if request.auth.uid.userEmail == userId
}
}
}
Run Code Online (Sandbox Code Playgroud)
我所做的唯一有效的事情(即我拿回所有产品)是如果我进行 match/{document=**) ,它将它向任何不是我想要的人开放。:)
有任何想法吗?
编辑:以防有人想知道角度代码。再说一次,如果我设置规则允许任何我做的事情取回数据。如果我限制它,到目前为止我什么也得不到。所以,我知道代码有效(getAll),因此一定是规则不正确。
编辑:我更新了代码,以便在从商店请求所有产品数据之前将用户电子邮件写入控制台。它成功输出了用户的电子邮件。
import { Injectable } from '@angular/core';
import { AngularFirestore, AngularFirestoreCollection } from '@angular/fire/firestore';
import { AngularFireAuth } from '@angular/fire/auth';
import { Product } from '../models/product.model';
@Injectable({
providedIn: 'root'
})
export class ProductsService { …Run Code Online (Sandbox Code Playgroud) javascript firebase-security angularfire firebase-authentication google-cloud-firestore
我正在努力找出如何设置每个用户可以上传到我的应用程序存储的存储限制。
我找到了在线方法Storage.storageLimitInBytes,但我在 Firebase 文档中甚至没有看到此方法,更不用说如何设置它的说明了。
一般来说,初创公司如何监控用户上传图像的次数,他们在用户文档中是否有一个字段,例如amountOfImagesUploaded:每次用户上传图像时我都会增加该计数,这样我就可以看到谁以这种方式滥用存储。
或者我是否需要类似的文档来跟踪用户每天上传的内容,当计数达到 100 或其他值时,然后对该用户采取行动。
对于我面临的这个问题,我非常感谢您的帮助。
有时控制台在打开网站时会显示这些错误
\nGET https://example.com/subpath/_next/static/9ufj5kFJf/_buildManifest.js\n[HTTP/3 404 Not Found 311ms]\n\nGET https://example.com/subpath/_next/static/9ufj5kFJf/_ssgManifest.js\n[HTTP/3 404 Not Found 334ms]\n\nLoading failed for the <script> with source \xe2\x80\x9chttps://example.com/subpath/_next/static/9ufj5kFJf/_buildManifest.js\xe2\x80\x9d. 1434-247:1:1\nLoading failed for the <script> with source \xe2\x80\x9chttps://example.com/subpath/_next/static/9ufj5kFJf/_ssgManifest.js\xe2\x80\x9d.\nRun Code Online (Sandbox Code Playgroud)\n该应用程序确实使用了 ISR,并且似乎有效,它确实得到了更新,这些文件有什么作用?如果他们失踪了会发生什么?
\n以前使用容器注册表时,可以使用此方法在项目之间复制容器
但是我无法使用 ArtifactRegistry 来实现此功能。如果我尝试
gcloud artifacts docker tags add \
us-east4-docker.pkg.dev/source-proj/my-repo/my-image:latest \
us-east4-docker.pkg.dev/dest-proj/my-repo/my-image:latest
Run Code Online (Sandbox Code Playgroud)
它给出了错误
ERROR: (gcloud.artifacts.docker.tags.add) Image us-east4-docker.pkg.dev/source-proj/my-repo/my-image
does not match image us-east4-docker.pkg.dev/dest-proj/my-repo/my-image
Run Code Online (Sandbox Code Playgroud)
我进行了搜索,但找不到任何有关如何执行此操作的示例或文档。
google-container-registry container-image docker-repository google-artifact-registry
我正在尝试使用 Selenium 构建解决方案,我可以使用 Firebase Functions 通过 Selenium 初始化和加载网页吗?
我发现一些资源说“不”;然而他们没有给出任何来源,而且他们已经4岁了……:
我如何或在哪里可以检查这种情况是否仍然存在?
如果我在 Cloud Run 中运行容器并在 python 代码中执行打印语句。我在哪里可以查看?云日志似乎显示包含本身的日志(构建等)?
为了经常调试我的代码,我会编写一些语句来帮助我弄清楚发生了什么。该打印输出位于哪里?
javascript ×4
firebase ×3
angularfire ×1
docker ×1
gcloud ×1
next.js ×1
python ×1
reactjs ×1
security ×1
selenium ×1
swift ×1
typescript ×1