@naturalcycles/backend-lib 3.1.0 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/deploy/deploy.util.js +1 -1
- package/dist/deploy/deployPrepare.js +2 -0
- package/dist/server/deployInfo.util.d.ts +1 -1
- package/dist/server/genericErrorMiddleware.js +6 -1
- package/package.json +2 -3
- package/src/deploy/deploy.util.ts +1 -1
- package/src/deploy/deployPrepare.ts +2 -0
- package/src/server/genericErrorMiddleware.ts +5 -1
|
@@ -7,7 +7,7 @@ const colors_1 = require("@naturalcycles/nodejs-lib/dist/colors");
|
|
|
7
7
|
const time_lib_1 = require("@naturalcycles/time-lib");
|
|
8
8
|
const yaml = require("js-yaml");
|
|
9
9
|
const APP_YAML_DEFAULT = () => ({
|
|
10
|
-
runtime: '
|
|
10
|
+
runtime: 'nodejs16',
|
|
11
11
|
service: 'default',
|
|
12
12
|
inbound_services: ['warmup'],
|
|
13
13
|
instance_class: 'F1',
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { DeployInfo } from '../deploy';
|
|
2
|
-
export declare const getDeployInfo: ((projectDir: string) => DeployInfo) & import("@naturalcycles/js-lib
|
|
2
|
+
export declare const getDeployInfo: ((projectDir: string) => DeployInfo) & import("@naturalcycles/js-lib").MemoizedFunction;
|
|
@@ -36,7 +36,12 @@ exports.genericErrorMiddleware = genericErrorMiddleware;
|
|
|
36
36
|
function respondWithError(req, res, err) {
|
|
37
37
|
var _a, _b;
|
|
38
38
|
const { headersSent } = res;
|
|
39
|
-
|
|
39
|
+
if (headersSent) {
|
|
40
|
+
req.error(`after headersSent`, err);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
req.error(err);
|
|
44
|
+
}
|
|
40
45
|
const originalError = (0, js_lib_1._anyToError)(err, Error, {
|
|
41
46
|
stringifyFn: nodejs_lib_1.inspectAnyStringifyFn,
|
|
42
47
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@naturalcycles/backend-lib",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"prepare": "husky install && patch-package",
|
|
6
6
|
"serve": "APP_ENV=dev nodemon",
|
|
@@ -45,7 +45,6 @@
|
|
|
45
45
|
"@types/ejs": "^3.0.0",
|
|
46
46
|
"@types/js-yaml": "^4.0.0",
|
|
47
47
|
"@types/node": "^16.4.1",
|
|
48
|
-
"esbuild": "^0.13.13",
|
|
49
48
|
"esbuild-register": "^3.1.2",
|
|
50
49
|
"fastify": "^3.20.1",
|
|
51
50
|
"jest": "^27.0.1",
|
|
@@ -85,7 +84,7 @@
|
|
|
85
84
|
"url": "https://github.com/NaturalCycles/backend-lib"
|
|
86
85
|
},
|
|
87
86
|
"engines": {
|
|
88
|
-
"node": ">=
|
|
87
|
+
"node": ">=16.13.0"
|
|
89
88
|
},
|
|
90
89
|
"type": "commonjs",
|
|
91
90
|
"description": "Standard library for making Express.js / AppEngine based backend services",
|
|
@@ -8,7 +8,7 @@ import { BackendCfg } from './backend.cfg.util'
|
|
|
8
8
|
import { AppYaml, DeployInfo } from './deploy.model'
|
|
9
9
|
|
|
10
10
|
const APP_YAML_DEFAULT = (): AppYaml => ({
|
|
11
|
-
runtime: '
|
|
11
|
+
runtime: 'nodejs16',
|
|
12
12
|
service: 'default',
|
|
13
13
|
inbound_services: ['warmup'],
|
|
14
14
|
instance_class: 'F1',
|
|
@@ -53,7 +53,11 @@ export function genericErrorMiddleware(
|
|
|
53
53
|
export function respondWithError(req: BackendRequest, res: BackendResponse, err: any): void {
|
|
54
54
|
const { headersSent } = res
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
if (headersSent) {
|
|
57
|
+
req.error(`after headersSent`, err)
|
|
58
|
+
} else {
|
|
59
|
+
req.error(err)
|
|
60
|
+
}
|
|
57
61
|
|
|
58
62
|
const originalError = _anyToError(err, Error, {
|
|
59
63
|
stringifyFn: inspectAnyStringifyFn,
|