【发布时间】:2021-03-19 10:25:09
【问题描述】:
我的 Bitbucket CI/CD 管道存在问题。管道本身运行良好,但是当我尝试访问它时应用程序被破坏了。该管道部署了一个 React App Engine Node.js 应用程序。当我访问该站点时,问题就来了。这是我在 Google Logging “找不到处理程序引用的静态文件:build/index.html”中收到的错误。
如果我手动部署应用程序,我没有任何问题,并且应用程序运行良好。仅当部署发生在 bitbucket 管道中时才会发生此应用程序错误。
这里是 app.yaml
runtime: nodejs12
handlers:
# Serve all static files with url ending with a file extension
- url: /(.*\..+)$
static_files: build/\1
upload: build/(.*\..+)$
# Catch all handler to index.html
- url: /.*
static_files: build/index.html
upload: build/index.html
这里是 bitbucket-pipelines.yml
pipelines:
branches:
master:
- step:
name: NPM Install and Build
image: node:14.15.1
script:
- npm install
- unset CI
- npm run build
- step:
name: Deploy to App Engine
image: google/cloud-sdk
script:
- gcloud config set project $GCLOUD_PROJECT
- 'echo "$GOOGLE_APPLICATION_CREDENTIALS" > google_application_credentials.json'
- gcloud auth activate-service-account --key-file google_application_credentials.json
- gcloud app deploy app.yaml
任何帮助将不胜感激。非常感谢。
【问题讨论】:
-
这个错误是在部署过程中出现还是部署正确你在尝试使用它时遇到错误?
-
@vitooh 它部署正确。这是我在尝试访问网站时在 Google Logging 中遇到的错误
-
@vitooh 我改写了我的帖子以澄清问题
标签: node.js reactjs google-app-engine bitbucket-pipelines