如何使用visual studio代码firebase-database 触发器函数进行调试?我尝试了模拟器,但是当我调用它时出现错误
functions debug myMethod
C:\functions\functions>functions debug createUserChat
ERROR: Error: Function myMethod in location us-central1 in project myProject does not exist
at C:\Users\Dev\AppData\Roaming\npm\node_modules\@google-cloud\functions-emulator\node_modules\grpc\src\client.js:554:15
Run Code Online (Sandbox Code Playgroud)
这段代码我想调试
require('@google-cloud/debug-agent').start({ allowExpressions: true });;
const functions = require('firebase-functions'),
admin = require('firebase-admin'),
logging = require('@google-cloud/logging')();
admin.initializeApp(functions.config().firebase);
exports.myMethod= functions.database.ref('Tasks/{taskID}/taskStatus').onUpdate(event =>{
// do sth.
});
Run Code Online (Sandbox Code Playgroud)
这是我的启动文件
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug Function",
"type": "node",
"request": "attach",
"port": 5858
}
]
}
Run Code Online (Sandbox Code Playgroud) 我正在使用GitHub Actions来触发我的dockerfile的构建,它将容器上传到GitHub Container Registry。在最后一步中,我通过SSH连接到我的远程DigitalOcean Droplet 并执行脚本以从 GHCR拉取和安装新映像。这个工作流程对我很有用,因为我只在项目中构建了一个容器。现在我正在使用docker compose,因为除了 API 之外我还需要 NGINX。我想保持在一个容器单滴,因为该项目目前对资源的要求不高。
在单个 VM 上使用 Github Actions 和 Docker Compose 自动部署到 DigitalOcean 的正确方法是什么?
我目前已知的选项是:
如果您知道更多选择,这可能更清洁或更高效,请告诉我!
不幸的是,我找到了一个docker-compose with Github Actions for CI 问题以供参考。
单个容器的 GitHub 操作
name: Github Container …Run Code Online (Sandbox Code Playgroud) 我必须将文件发送到 API,因此我必须使用fs.readFileSync(). 将图片上传到存储后,我正在调用我的函数来执行 API 调用。但我无法从存储中获取该文件。这是代码的一部分,结果始终为 null。我也尝试.getFiles()不使用参数,然后我得到了所有文件,但我不想通过迭代来过滤它们。
exports.stripe_uploadIDs = functions.https //.region("europe-west1")
.onCall((data, context) => {
const authID = context.auth.uid;
console.log("request is authentificated? :" + authID);
if (!authID) {
throw new functions.https.HttpsError("not authorized", "not authorized");
}
let accountID;
let result_fileUpload;
let tempFile = path.join(os.tmpdir(), "id_front.jpg");
const options_id_front_jpeg = {
prefix: "/user/" + authID + "/id_front.jpg"
};
const storageRef = admin
.storage()
.bucket()
.getFiles(options_id_front)
.then(results => {
console.log("JPG" + JSON.stringify(results));
// need to write this file to tempFile
return …Run Code Online (Sandbox Code Playgroud) 我不是 docker 专家,我只是在习惯它。我想将主机上生成的 ssl 证书复制到我的 docker 容器中。我读到它应该能够处理volumesdocker-compose 文件中的参数,但启动我的服务器时它总是令人兴奋,因为它无法在工作目录中找到复制的文件。
文件夹结构
- repo
- backend
- api
- static
- ssl
- dockerfile
- frontend
- docker-compose.yml
Run Code Online (Sandbox Code Playgroud)
Dockerfile
FROM node:14-alpine
ENV NODE_ENV=production SERVER_PORT_HTTP=80 SERVER_PORT_HTTPS=443
WORKDIR /usr/src/app
RUN npm install
COPY . .
EXPOSE ${SERVER_PORT_HTTP} ${SERVER_PORT_HTTPS}
CMD [ "npm", "run", "start" ]
Run Code Online (Sandbox Code Playgroud)
Docker-Compose
version: "3"
services:
api:
build:
context: ./backend/api
ports:
- "80:80"
- "443:443"
volumes:
- /etc/letsencrypt/live/api.example.com:/static/ssl
restart: unless-stopped
Run Code Online (Sandbox Code Playgroud) 我想在使用拖放时在两行之间画一条线。其功能是简单的视觉功能,以便用户知道他将行放在哪里。该行应该看起来像 excel 一次。这是我的代码:
Pen _marqueePen = new Pen(Color.Gray, 2);
float[] dashValues = {1f,1f};
_marqueePen.DashPattern = dashValues;
Run Code Online (Sandbox Code Playgroud)
但这看起来是这样的

我想看起来像这样:

我是WinForms 和C1 Flexgrid控件。
我正在为我当前的项目使用 React-Navigation 库,但不喜欢向后滑动功能。只有当您将手指放在屏幕的整个边缘以便手势向后滑动时,它才会被触发。我已经阅读了API 参考,但找不到任何关于我的行为问题的信息。