Firebase 云构建:部署函数-错误:HTTP错误:404,未找到方法
我想使用CI/CD管道(云构建)部署我的云功能 一切都很好,但我仍停留在这个阶段:Firebase 云构建:部署函数-错误:HTTP错误:404,未找到方法,firebase,google-cloud-functions,google-cloud-build,Firebase,Google Cloud Functions,Google Cloud Build,我想使用CI/CD管道(云构建)部署我的云功能 一切都很好,但我仍停留在这个阶段: Error: HTTP Error: 404, Method not found. 注意:PROJECT_ID是我的真实gcloud项目ID 我将此git回购协议用作参考: Mycloudbuild.yaml正在解密firebase令牌,构建docker映像并运行该过程: steps: # Decrypt env secrets - name: gcr.io/cloud-builders/gcloud
Error: HTTP Error: 404, Method not found.
注意:PROJECT_ID是我的真实gcloud项目ID
我将此git回购协议用作参考:
Mycloudbuild.yaml正在解密firebase令牌,构建docker映像并运行该过程:
steps:
# Decrypt env secrets
- name: gcr.io/cloud-builders/gcloud
args:
- kms
- decrypt
- --ciphertext-file=.env.enc
- --plaintext-file=.env
- --location=global
- --keyring=cloudbuild-env
- --key=firebase-token
id: 'decrypt'
- name: gcr.io/cloud-builders/docker
args: ['build', '-t', 'gcr.io/$PROJECT_ID/firebase', '.']
id: 'build docker image'
- name: gcr.io/cloud-builders/npm
args: ['install']
dir: functions
id: 'functions npm install'
- name: gcr.io/$PROJECT_ID/firebase
args: ['deploy']
id: 'deploy functions'
images:
- gcr.io/$PROJECT_ID/firebase
timeout: 600s
现在,我的Dockerfile和firebase.bash与git repo中显示的相同:
Dockerfile
FROM node:8
RUN npm i -g firebase-tools
ADD firebase.bash /usr/bin
RUN chmod +x /usr/bin/firebase.bash
ENTRYPOINT [ "/usr/bin/firebase.bash" ]
firebase.bash
#!/bin/bash
# run the original firebase
if [ $FIREBASE_TOKEN ]; then
firebase "$@" --token $FIREBASE_TOKEN
else
firebase "$@"
fi
我还有一个package.json来运行部署(不确定):
最后,我的firebase.json如下所示:
{
"functions": {
"predeploy": [
"npm --prefix \"$RESOURCE_DIR\" run lint",
"npm --prefix \"$RESOURCE_DIR\" run build"
],
"source": "functions"
}
}
我已启用Firebase Admin rôle等,但仍无法完成以下工作:(如果您在使用Firebase CLI部署代码时遇到问题,并且没有具体的、可操作的错误消息,请与Firebase支持部门联系。我不知道发生404错误的原因。但我知道使用Firebase进行云构建的设置示例。您能看到以下问题并尝试设置吗?
{
"scripts": {
"deploy": "firebase deploy --only functions --token \"$FIREBASE_TOKEN\""
}
}
{
"functions": {
"predeploy": [
"npm --prefix \"$RESOURCE_DIR\" run lint",
"npm --prefix \"$RESOURCE_DIR\" run build"
],
"source": "functions"
}
}