错误:服务器错误带有Express和Node.js的Google应用引擎 [英] Error: Server error Google app engine with express and nodejs
问题描述
我将GAE用于我的nodejs Express后端.它起得比较早,但是突然间我不断得到
Im using GAE for my nodejs express backend. It worked earlier, but suddenly I keep getting
错误:服务器错误. 服务器遇到错误,无法完成您的请求.
Error: Server error. The server encountered an error and could not complete your request.
请在30秒后重试.
我的错误日志如下:
默认[20181129t203637]"GET/HTTP/1.1" 500
default[20181129t203637] "GET / HTTP/1.1" 500
默认[20181129t203637]"GET/favicon.ico HTTP/1.1" 500
default[20181129t203637] "GET /favicon.ico HTTP/1.1" 500
默认[20181129t203637]"GET/favicon.ico HTTP/1.1" 500
default[20181129t203637] "GET /favicon.ico HTTP/1.1" 500
默认[20181129t203637]"GET/favicon.ico HTTP/1.1" 500
default[20181129t203637] "GET /favicon.ico HTTP/1.1" 500
我尝试将favicon.ico添加到我的公用文件夹中,并为favicon.ico安装npm serve-favicon,但是仍然存在相同的错误.我以为这是一个限制,但我尝试更改帐户,更改不同的快递项目,仍然会出现相同的错误.
I tried adding favicon.ico to my public folder and install npm serve-favicon for the favicon.ico but same error still persist. I thought it was a limit but I tried changing accounts, changing different express project, the same error still comes out.
我的app.yaml文件:
运行时:nodejs8
runtime :nodejs8
instance_class:F4_1G
instance_class: F4_1G
也有cron.yaml文件,但是我还没有运行cron作业.
Also have cron.yaml file but I haven't run the cron job yet.
我的项目在本地运行时没有任何问题. 有没有什么办法解决这一问题?
There is nothing wrong with my project when it s run locally. Is there any way to fix this?
推荐答案
这可能是因为您没有准备好处理请求的活动实例,这导致它们在App Engine将您的代码加载到新实例中时超时.您可以通过减少时间来缓解这种情况加载代码或通过实施预热请求在没有任何流量的情况下使您的实例保持活动状态.
This is probably because you don't have active instances ready to handle requests, which causes them to time out while App Engine loads your code into a fresh instance. You can mitigate this by reducing the time it takes to load your code or by implementing warmup requests to keep your instances alive when there isn't any traffic.
这篇关于错误:服务器错误带有Express和Node.js的Google应用引擎的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!