我无法为自己的一生解决这个问题。它经常发生一次,不会对应用程序本身造成任何问题,但是我不知道是什么原因造成的。我与浏览器同时调用api,如果与此有关。
def account_name(row):
if row['Name'] == None and row['Secondary_Name'] == None:
return row['Third_Name']
elif row['Name'] == 'GENERAL':
if row['Secondary_Name'] == None:
return row['Third_Name']
else:
return row['Name']
我已将调用简化为一个非常简单的函数,并确保该调用返回唯一值(我认为可能是304问题)
[Nest] 16608 - 11/7/2018, 1:23:08 PM [NestApplication] Nest application successfully started
[Nest] 16608 - 11/7/2018, 1:23:23 PM [LoggerMiddleware] Request /api/observation-statement/pending-count +14943ms
[Nest] 16608 - 11/7/2018, 1:23:23 PM [LoggerMiddleware] Request /api/observation-statement/revision-count +16ms
(node:14968) UnhandledPromiseRejectionWarning: Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
at ServerResponse.setHeader (_http_outgoing.js:469:11)
at ServerResponse.header (C:\Users\Ricardo Saracino\IdeaProjects\sor-api\node_modules\express\lib\response.js:767:10)
at ServerResponse.send (C:\Users\Ricardo Saracino\IdeaProjects\sor-api\node_modules\express\lib\response.js:170:12)
at ServerResponse.json (C:\Users\Ricardo Saracino\IdeaProjects\sor-api\node_modules\express\lib\response.js:267:15)
at ExpressAdapter.reply (C:\Users\Ricardo Saracino\IdeaProjects\sor-api\node_modules\@nestjs\core\adapters\express-adapter.js:44:52)
at ExceptionsHandler.catch (C:\Users\Ricardo Saracino\IdeaProjects\sor-api\node_modules\@nestjs\core\exceptions\base-exception-filter.js:16:33)
at ExceptionsHandler.next (C:\Users\Ricardo Saracino\IdeaProjects\sor-api\node_modules\@nestjs\core\exceptions\exceptions-handler.js:15:20)
at C:\Users\Ricardo Saracino\IdeaProjects\sor-api\node_modules\@nestjs\core\router\router-proxy.js:23:35
at Layer.handle_error (C:\Users\Ricardo Saracino\IdeaProjects\sor-api\node_modules\express\lib\router\layer.js:71:5)
at trim_prefix (C:\Users\Ricardo Saracino\IdeaProjects\sor-api\node_modules\express\lib\router\index.js:315:13)
(node:14968) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:14968) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
这是在中间件之前发生的