我想开发一个Google Cloud Functions端点,该端点将订阅对Google Cloud Storage存储桶的文件更改,并将该文件FTP到第三方FTP站点,该站点将客户端的IP地址列入白名单.
因此,可以为Google Cloud Functions容器获取静态IP地址?
使用事务使用实时数据库触发器递增计数器是否可以接受?
exports.incPostCount = functions.database.ref('/threadsMeta/{threadId}/posts')
.onWrite(event => {
admin.database().ref('/analytics/postCount')
.transaction(count => {
if (count === null) {
return count = 1
} else {
return count + 1
}
})
});
Run Code Online (Sandbox Code Playgroud) javascript node.js firebase firebase-realtime-database google-cloud-functions
对于我们的网络应用,我们目前正在使用Firebase的免费计划,并需要发送各种事件/触发器的电子邮件.问题是,我认为Mailgun可以完美地完成这项任务以及他们的云功能,但看起来可以将他们的API仅用于Firebase的付费计划,当我们的应用程序仍在开发中时,我们现在不打算使用它们.因此,如果我们不知道如何使用Firebase以最少的金额实现电子邮件功能,我们就会陷入困境(当我们对我们的应用程序是否能够获得任何利润时,我们可以随时支付或支付更多费用). ..任何人都可以帮助我.现在以任何方式(几乎)自由地进行 - 我们可以在以后随时升级吗?
谢谢!Piyush Soni
尝试从 Web 执行 Cloud Function 端点时,我收到以下错误:
<!DOCTYPE html>
<html lang=en>
<meta charset=utf-8>
<meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
<title>Error 403 (Forbidden)!!1</title>
<style>
*{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5pxno-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}
</style>
<a href=//www.google.com/><span id=logo aria-label=Google></span></a>
<p><b>403.</b> <ins>That’s an error.</ins>
<p>Access is forbidden. <ins>That’s all we know.</ins>
Run Code Online (Sandbox Code Playgroud)
我跟着这个教程:https : //github.com/GoogleCloudPlatform/python-docs-samples/blob/master/functions/helloworld/main.py
调用此处所述的函数时:https : //cloud.google.com/functions/docs/writing/http,我收到 403 错误。我已登录 …
我已将 firebase 配置为在本地运行以通过此链接使用模拟器进行调试。
现在我希望能够运行连接到本地主机的应用程序以调试触发器。有没有办法通过将我的 flutter 应用程序配置为使用 localhost 来实现这一点?
我的模拟器运行如下:
我可以从Google Cloud Function写入容器的本地文件系统吗?AWS Lambda允许写入/ tmp:
问:如果我的AWS Lambda函数需要磁盘空间,该怎么办?
每个Lambda函数在其自己的/ tmp目录中接收500MB的非持久磁盘空间.
GCF中有相应的东西吗?
我正在尝试调用 Google 云函数,该函数是由云调度程序触发的 Http。但每当我尝试运行云调度程序时,它总是显示权限被拒绝错误
httpRequest: {
status: 403
}
insertId: "14igacagbanzk3b"
jsonPayload: {
@type: "type.googleapis.com/google.cloud.scheduler.logging.AttemptFinished"
jobName: "projects/***********/locations/europe-west1/jobs/twilio-cloud-scheduler"
status: "PERMISSION_DENIED"
targetType: "HTTP"
url: "https://europe-west1-********.cloudfunctions.net/function-2"
}
logName: "projects/*******/logs/cloudscheduler.googleapis.com%2Fexecutions"
receiveTimestamp: "2020-09-20T15:11:13.240092790Z"
resource: {
labels: {
job_id: "***********"
location: "europe-west1"
project_id: "**********"
}
type: "cloud_scheduler_job"
}
severity: "ERROR"
timestamp: "2020-09-20T15:11:13.240092790Z"
}
Run Code Online (Sandbox Code Playgroud)
我尝试过的解决方案 -
我的云调度程序仅在我运行以下命令时才起作用
gcloud 函数 add-iam-policy-binding 云函数 --member="allUsers" --role="roles/cloudfunctions.invoker"
google-cloud-platform google-cloud-functions google-cloud-scheduler
我正在使用 Firebase 函数构建一个解析 CSV 文件的 API。
当我尝试使用 csv-parse/sync 而不是 csv-parse 时,部署到 Firebase Functions 失败并出现以下错误:
Error: Error parsing triggers: Cannot find module 'csv-parse/sync''
Require stack:
- /Users/xxx/Programming/xxx/Firebase Functions/xxx/functions/lib/index.js
- /usr/local/lib/node_modules/firebase-tools/lib/deploy/functions/runtimes/node/triggerParser.js
Try running "npm install" in your functions directory before deploying.
Run Code Online (Sandbox Code Playgroud)
我已经使用以下方式导入:
import { parse } from 'csv-parse/sync';
然后在这样的代码中使用:
interface EventData {
update: string;
id: string;
title: string;
description: string;
category: string;
ages: string;
place: string;
placeCoordinate: string;
startDate: string;
startTime: string;
length: string;
url: string;
arrName: string;
}
let events: Array<EventData> …Run Code Online (Sandbox Code Playgroud) 我在 Firebase Cloud Functions 日志中收到奇怪的警告消息:
Snapshot has no readTime. Using now()
Run Code Online (Sandbox Code Playgroud)
我正在运行相当多的函数,其中有很多函数都会发生这种情况。但这种情况并不是每次调用都会发生,只是偶尔发生。
snapshotConstructor谷歌搜索在库中的函数中找到了负责此消息的行firebase-functions。您可以在 Github 上找到它。似乎data.value.readTime在 上不可用Event。
到底是什么导致了这个错误,这是一个问题吗?
更新:我发现当onWrite同一个文档同时触发函数时就会发生这种情况。我有一些这样开始的函数:
functions
.firestore.document('organizations/{organizationId}/updates/{updateId}')
.onWrite(async (change, context) => {...
Run Code Online (Sandbox Code Playgroud)
同样,这种情况不会每次被触发时都会发生,但经常足以引起关注。
我正在学习使用 Firebase 云函数,我正在关注 Firebase 的官方教程视频学习 JavaScript 承诺(Pt.1)
当我运行本地服务器并转到 HTTP 链接时,我得到
错误:默认 Firebase 应用不存在。确保在使用任何 Firebase 服务之前调用 initializeApp()。
我试图找到解决方案,但找不到任何地方。我有一些模糊相关的问题,但对于 javascript,我的代码是打字稿。我确实在 .js 和 .ts 文件中添加了建议的语法
admin.initializeApp(functions.config().firebase);
Run Code Online (Sandbox Code Playgroud)
但是,我仍然遇到相同的错误
这是我的 index.tcs。
import * as functions from 'firebase-functions';
import * as admin from 'firebase-admin';
// Start writing Firebase Functions
// https://firebase.google.com/docs/functions/typescript
export const getVoucher = functions.https.onRequest((request, response) => {
const promise = admin.firestore().doc('/voucher/Eg2AtnGmKmX8Y0vBZiBG').get()
const p2 = promise.then(snapshot=>{
const data = snapshot.data()
response.send(data)
})
p2.catch(error => {
//Handlle the error
console.log('error: '+error)
response.status(500).send(error)
})
});
Run Code Online (Sandbox Code Playgroud)
该功能在部署到 …