我正在尝试在Google App Engine上部署我的React Express应用程序。一切都可以在localhost上正常运行,但是当我部署时我收到404错误:
我认为我的处理程序可能有问题,但是我不确定,将不胜感激。
Cannot GET /
Failed to load resource: the server responded with a status of 404 ()
这是控制台日志所说的:
httpRequest: {
latency: "0.006s"
referer: "-"
remoteIp: "2001:8000:11d3:ed00:4854:5aba:9f93:dd47"
requestMethod: "GET"
requestUrl: "/"
responseSize: "139"
status: 404
userAgent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.157 Safari/537.36"
}
insertId: "ezhqr2g2ohjlxu"
jsonPayload: {
appLatencySeconds: "0.004"
httpRequest: {
protocol: "HTTP/1.1"
}
latencySeconds: "0.006"
trace: "dd9ffc275b4f1457905cf864bf17539c"
}
labels: {
appengine.googleapis.com/instance_name: "aef-web--form-20190524t155912-31cn"
appengine.googleapis.com/trace_id: "dd9ffc275b4f1457905cf864bf17539c"
compute.googleapis.com/resource_id: "1391234725058328108"
compute.googleapis.com/resource_name: "a68af8bf7290"
compute.googleapis.com/zone: "australia-southeast1-b"
}
logName: "confidential"
receiveTimestamp: "2019-05-26T22:36:57.374278865Z"
resource: {
labels: {
module_id: "web-form"
project_id: "confidential"
version_id: "20190524t155912"
}
type: "gae_app"
}
timestamp: "2019-05-26T22:36:54.837Z"
trace: "confidential"
}
这是我的Yaml文件:
service: web-form
runtime: nodejs
env: flex
automatic_scaling:
min_num_instances: 1
max_num_instances: 1
env_variables:
PROJECT_ID: 'project'
handlers:
- url: /*
secure: always
redirect_http_response_code: 301
script: auto
resources:
cpu: 1
memory_gb: 1.7
disk_size_gb: 10
volumes:
- name: ramdisk1
volume_type: tmpfs
size_gb: 1