@valbuild/server 0.148.1 → 0.148.2
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/CHANGELOG.md +23 -0
- package/browser/dist/valbuild-server-browser.cjs.dev.js +1 -1
- package/browser/dist/valbuild-server-browser.cjs.prod.js +1 -1
- package/browser/dist/valbuild-server-browser.esm.js +1 -1
- package/dist/{ValRouterCore-9bdaaf89.cjs.dev.js → ValRouterCore-72594062.cjs.dev.js} +34 -34
- package/dist/{ValRouterCore-7ca3dc68.esm.js → ValRouterCore-ad10b6cf.esm.js} +34 -34
- package/dist/{ValRouterCore-42772c21.cjs.prod.js → ValRouterCore-dd465930.cjs.prod.js} +34 -34
- package/dist/{getJsonEntryAtCommit-2e36e805.cjs.prod.js → getJsonEntryAtCommit-2a0e9eaf.cjs.prod.js} +1 -1
- package/dist/{getJsonEntryAtCommit-64f67a50.cjs.dev.js → getJsonEntryAtCommit-85159574.cjs.dev.js} +1 -1
- package/dist/{getJsonEntryAtCommit-40b6d9c1.esm.js → getJsonEntryAtCommit-e32a470b.esm.js} +1 -1
- package/dist/valbuild-server.cjs.dev.js +32 -32
- package/dist/valbuild-server.cjs.prod.js +32 -32
- package/dist/valbuild-server.esm.js +33 -33
- package/package.json +4 -4
|
@@ -1463,7 +1463,7 @@ encode = bytesToBase64) {
|
|
|
1463
1463
|
}]) => {
|
|
1464
1464
|
if (remote) return;
|
|
1465
1465
|
const bytes = await ops.getBase64EncodedBinaryFileFromPatch(filePath, patchId, remote).catch(error => {
|
|
1466
|
-
|
|
1466
|
+
core.Internal.log.error("Could not read a committed file", filePath, error);
|
|
1467
1467
|
return null;
|
|
1468
1468
|
});
|
|
1469
1469
|
if (bytes === null) unread.push(filePath);else files[filePath] = encode(bytes);
|
|
@@ -2431,7 +2431,7 @@ class ValOps {
|
|
|
2431
2431
|
for (const [moduleFilePathS, source] of Object.entries(sources)) {
|
|
2432
2432
|
const moduleFilePath = moduleFilePathS;
|
|
2433
2433
|
if (errors[moduleFilePath] !== undefined) {
|
|
2434
|
-
|
|
2434
|
+
core.Internal.log.error("not adopting the committed source of a module whose patches " + "did not apply cleanly. Its content here stays as it was until the " + "modules are re-evaluated.", {
|
|
2435
2435
|
moduleFilePath,
|
|
2436
2436
|
errors: errors[moduleFilePath]
|
|
2437
2437
|
});
|
|
@@ -2981,7 +2981,7 @@ class ValOps {
|
|
|
2981
2981
|
if (!errors[path]) {
|
|
2982
2982
|
errors[path] = [];
|
|
2983
2983
|
}
|
|
2984
|
-
|
|
2984
|
+
core.Internal.log.error("Module not found", path);
|
|
2985
2985
|
errors[path].push({
|
|
2986
2986
|
patchId: patchData.patchId,
|
|
2987
2987
|
skipped: true,
|
|
@@ -2994,7 +2994,7 @@ class ValOps {
|
|
|
2994
2994
|
}
|
|
2995
2995
|
const patchId = patchData.patchId;
|
|
2996
2996
|
if (errors[path]) {
|
|
2997
|
-
|
|
2997
|
+
core.Internal.log.error("Cannot apply patch: previous errors exists", path, errors[path]);
|
|
2998
2998
|
errors[path].push({
|
|
2999
2999
|
patchId: patchId,
|
|
3000
3000
|
skipped: true,
|
|
@@ -3158,7 +3158,7 @@ class ValOps {
|
|
|
3158
3158
|
// applyPatch mutates the source. On add operations it adds more than once? There is something strange going on... deepClone seems to fix, but is that the right solution?
|
|
3159
3159
|
jsonOps, applicableOps.concat(...Object.values(fileFixOps)));
|
|
3160
3160
|
if (fp.result.isErr(patchRes)) {
|
|
3161
|
-
|
|
3161
|
+
core.Internal.log.error("Could not apply patch", JSON.stringify({
|
|
3162
3162
|
path,
|
|
3163
3163
|
patchId,
|
|
3164
3164
|
error: patchRes.error,
|
|
@@ -3805,7 +3805,7 @@ class ValOps {
|
|
|
3805
3805
|
return fp.result.ok(entries);
|
|
3806
3806
|
};
|
|
3807
3807
|
const collectPatchError = (err, patchId, op) => {
|
|
3808
|
-
|
|
3808
|
+
core.Internal.log.error("Could not patch", JSON.stringify({
|
|
3809
3809
|
path,
|
|
3810
3810
|
patchId,
|
|
3811
3811
|
error: err,
|
|
@@ -4334,7 +4334,7 @@ class ValOps {
|
|
|
4334
4334
|
// sends it again later, so an error line here would be one a minute.
|
|
4335
4335
|
return fp.result.err(saveRes.error);
|
|
4336
4336
|
}
|
|
4337
|
-
|
|
4337
|
+
core.Internal.log.error(`Could not save source patch at path: '${path}'. Error: ${saveRes.error.errorType === "other" ? saveRes.error.message : saveRes.error.errorType}`);
|
|
4338
4338
|
if (saveRes.error.errorType === "patch-head-conflict") {
|
|
4339
4339
|
return fp.result.err({
|
|
4340
4340
|
errorType: "patch-head-conflict"
|
|
@@ -5574,11 +5574,11 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
5574
5574
|
token
|
|
5575
5575
|
};
|
|
5576
5576
|
} else {
|
|
5577
|
-
|
|
5577
|
+
core.Internal.log.debug("Failed to get data from code: ", res.status);
|
|
5578
5578
|
return null;
|
|
5579
5579
|
}
|
|
5580
5580
|
}).catch(err => {
|
|
5581
|
-
|
|
5581
|
+
core.Internal.log.debug("Failed to get user from code: ", err);
|
|
5582
5582
|
return null;
|
|
5583
5583
|
});
|
|
5584
5584
|
};
|
|
@@ -6298,7 +6298,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
6298
6298
|
// the environment when @valbuild/server was built. See getSettings.
|
|
6299
6299
|
const settingsRes = await getSettings(options.project, remoteFileAuth, options.valContentUrl);
|
|
6300
6300
|
if (!settingsRes.success) {
|
|
6301
|
-
|
|
6301
|
+
core.Internal.log.warn("Could not get remote files settings: " + settingsRes.message);
|
|
6302
6302
|
return {
|
|
6303
6303
|
status: 400,
|
|
6304
6304
|
json: {
|
|
@@ -6743,7 +6743,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
6743
6743
|
let contentBaseUrl = null;
|
|
6744
6744
|
let contentAuthNonce = null;
|
|
6745
6745
|
if (!options.project) {
|
|
6746
|
-
|
|
6746
|
+
core.Internal.log.debug("Direct content-host uploads (AI images) disabled: no `project` set in val.config (and VAL_PROJECT env var is not set).");
|
|
6747
6747
|
} else if (!isFsOps(serverOps)) {
|
|
6748
6748
|
/*
|
|
6749
6749
|
* Presigning needs a content host to presign AGAINST, and a local
|
|
@@ -6756,11 +6756,11 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
6756
6756
|
* the patch upload base url -- still works, and the only thing lost
|
|
6757
6757
|
* is the browser posting AI images straight to the content host.
|
|
6758
6758
|
*/
|
|
6759
|
-
|
|
6759
|
+
core.Internal.log.debug("Direct content-host uploads (AI images) disabled: this store has no content host to presign against.");
|
|
6760
6760
|
} else {
|
|
6761
6761
|
const authDataRes = await getRemoteFileAuth();
|
|
6762
6762
|
if (authDataRes.status !== 200) {
|
|
6763
|
-
|
|
6763
|
+
core.Internal.log.warn("Direct content-host uploads (AI images) disabled: " + authDataRes.json.message);
|
|
6764
6764
|
} else {
|
|
6765
6765
|
const corsOrigin = "*"; // TODO: add cors origin
|
|
6766
6766
|
const presignedAuthNonce = await serverOps.getPresignedAuthNonce(options.project, corsOrigin, authDataRes.json.remoteFileAuth);
|
|
@@ -6768,7 +6768,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
6768
6768
|
contentBaseUrl = presignedAuthNonce.data.baseUrl;
|
|
6769
6769
|
contentAuthNonce = presignedAuthNonce.data.nonce;
|
|
6770
6770
|
} else {
|
|
6771
|
-
|
|
6771
|
+
core.Internal.log.warn("Direct content-host uploads (AI images) disabled: " + presignedAuthNonce.error.message);
|
|
6772
6772
|
}
|
|
6773
6773
|
}
|
|
6774
6774
|
}
|
|
@@ -6943,7 +6943,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
6943
6943
|
});
|
|
6944
6944
|
if (fetchedPatchesRes.error) {
|
|
6945
6945
|
// Error is singular
|
|
6946
|
-
|
|
6946
|
+
core.Internal.log.error("Failed to get patches", fetchedPatchesRes.error);
|
|
6947
6947
|
return {
|
|
6948
6948
|
status: 500,
|
|
6949
6949
|
json: {
|
|
@@ -6954,7 +6954,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
6954
6954
|
}
|
|
6955
6955
|
if (fetchedPatchesRes.errors && Object.keys(fetchedPatchesRes.errors).length > 0) {
|
|
6956
6956
|
// Errors is plural. Different property than above.
|
|
6957
|
-
|
|
6957
|
+
core.Internal.log.error("Failed to get patches", fetchedPatchesRes.errors);
|
|
6958
6958
|
return {
|
|
6959
6959
|
status: 500,
|
|
6960
6960
|
json: {
|
|
@@ -7005,7 +7005,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
7005
7005
|
const ids = query.id;
|
|
7006
7006
|
const deleteRes = await serverOps.deletePatches(ids);
|
|
7007
7007
|
if (deleteRes.errors && Object.keys(deleteRes.errors).length > 0) {
|
|
7008
|
-
|
|
7008
|
+
core.Internal.log.error("Failed to delete patches", deleteRes.errors);
|
|
7009
7009
|
return {
|
|
7010
7010
|
status: 500,
|
|
7011
7011
|
json: {
|
|
@@ -7064,7 +7064,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
7064
7064
|
}
|
|
7065
7065
|
const moduleErrors = await serverOps.getModuleErrors();
|
|
7066
7066
|
if ((moduleErrors === null || moduleErrors === void 0 ? void 0 : moduleErrors.length) > 0) {
|
|
7067
|
-
|
|
7067
|
+
core.Internal.log.error("Module errors", moduleErrors);
|
|
7068
7068
|
return {
|
|
7069
7069
|
status: 500,
|
|
7070
7070
|
json: {
|
|
@@ -7082,7 +7082,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
7082
7082
|
serializedSchemas[moduleFilePath] = schema["executeSerialize"]();
|
|
7083
7083
|
}
|
|
7084
7084
|
} catch (e) {
|
|
7085
|
-
|
|
7085
|
+
core.Internal.log.error("Failed to serialize schemas", e);
|
|
7086
7086
|
return {
|
|
7087
7087
|
status: 500,
|
|
7088
7088
|
json: {
|
|
@@ -7268,7 +7268,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
7268
7268
|
const sourcesSha = await serverOps.getSourcesSha();
|
|
7269
7269
|
const moduleErrors = await serverOps.getModuleErrors();
|
|
7270
7270
|
if ((moduleErrors === null || moduleErrors === void 0 ? void 0 : moduleErrors.length) > 0) {
|
|
7271
|
-
|
|
7271
|
+
core.Internal.log.error("Module errors", moduleErrors);
|
|
7272
7272
|
return {
|
|
7273
7273
|
status: 500,
|
|
7274
7274
|
json: {
|
|
@@ -7977,11 +7977,11 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
7977
7977
|
...serverOps.analyzePatches(survivors, patches.commits, commit),
|
|
7978
7978
|
...survivingPatches
|
|
7979
7979
|
});
|
|
7980
|
-
|
|
7980
|
+
core.Internal.log.error("removed unpublished changes that could not be applied", removed);
|
|
7981
7981
|
}
|
|
7982
7982
|
}
|
|
7983
7983
|
if (preparedCommit.hasErrors) {
|
|
7984
|
-
|
|
7984
|
+
core.Internal.log.error("Failed to create commit", JSON.stringify({
|
|
7985
7985
|
sourceFilePatchErrors: preparedCommit.sourceFilePatchErrors,
|
|
7986
7986
|
binaryFilePatchErrors: preparedCommit.binaryFilePatchErrors
|
|
7987
7987
|
}, null, 2));
|
|
@@ -8039,7 +8039,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
8039
8039
|
}
|
|
8040
8040
|
const uploadRes = await serverOps.uploadRemoteFiles(preparedCommit, authRes.json.remoteFileAuth);
|
|
8041
8041
|
if (Object.keys(uploadRes.errors).length > 0) {
|
|
8042
|
-
|
|
8042
|
+
core.Internal.log.error("Failed to upload remote files", uploadRes.errors);
|
|
8043
8043
|
return {
|
|
8044
8044
|
status: 400,
|
|
8045
8045
|
json: {
|
|
@@ -8071,7 +8071,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
8071
8071
|
const remoteFileAuth = (_remoteFileAuthRes = remoteFileAuthRes) === null || _remoteFileAuthRes === void 0 || (_remoteFileAuthRes = _remoteFileAuthRes.json) === null || _remoteFileAuthRes === void 0 ? void 0 : _remoteFileAuthRes.remoteFileAuth;
|
|
8072
8072
|
const saveRes = await serverOps.saveOrUploadFiles(preparedCommit, mode, remoteFileAuth);
|
|
8073
8073
|
if (Object.keys(saveRes.errors).length > 0) {
|
|
8074
|
-
|
|
8074
|
+
core.Internal.log.error("Failed to save files", saveRes.errors);
|
|
8075
8075
|
return {
|
|
8076
8076
|
status: 400,
|
|
8077
8077
|
json: {
|
|
@@ -8130,13 +8130,13 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
8130
8130
|
*/
|
|
8131
8131
|
const deleteRes = await serverOps.deletePatches(consumed);
|
|
8132
8132
|
if ("error" in deleteRes && deleteRes.error !== undefined) {
|
|
8133
|
-
|
|
8133
|
+
core.Internal.log.error(`got an error while cleaning up patches after publish: ${deleteRes.error.message}`);
|
|
8134
8134
|
} else if ("errors" in deleteRes && deleteRes.errors !== undefined) {
|
|
8135
8135
|
// Per patch, and not fatal: the files are written, so the save
|
|
8136
8136
|
// succeeded. A patch left behind is announced again on the next
|
|
8137
8137
|
// stat, applies to a base that already contains it, and is removed
|
|
8138
8138
|
// then.
|
|
8139
|
-
|
|
8139
|
+
core.Internal.log.error("could not clean up some patches after publish", deleteRes.errors);
|
|
8140
8140
|
}
|
|
8141
8141
|
return {
|
|
8142
8142
|
status: 200,
|
|
@@ -8169,7 +8169,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
8169
8169
|
commitToGit
|
|
8170
8170
|
}) : await commitToGit();
|
|
8171
8171
|
if (commitRes.error) {
|
|
8172
|
-
|
|
8172
|
+
core.Internal.log.error("Failed to commit", commitRes.error);
|
|
8173
8173
|
if ("isNotFastForward" in commitRes && commitRes.isNotFastForward) {
|
|
8174
8174
|
return {
|
|
8175
8175
|
status: 409,
|
|
@@ -9058,7 +9058,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
9058
9058
|
// TypeScript compiler. See `patch/ts/publishKit.ts`.
|
|
9059
9059
|
const {
|
|
9060
9060
|
getJsonEntryAtCommit
|
|
9061
|
-
} = await Promise.resolve().then(function () { return require('./getJsonEntryAtCommit-
|
|
9061
|
+
} = await Promise.resolve().then(function () { return require('./getJsonEntryAtCommit-2a0e9eaf.cjs.prod.js'); });
|
|
9062
9062
|
const res = await getJsonEntryAtCommit(serverOps, req.query.commit_sha, req.query.path, req.query.key);
|
|
9063
9063
|
if (fp.result.isErr(res)) {
|
|
9064
9064
|
return historyErrorResponse(res.error);
|
|
@@ -9147,7 +9147,7 @@ const ValServer = (valModules, options, callbacks, platform) => {
|
|
|
9147
9147
|
const remote = query.remote === "true";
|
|
9148
9148
|
const patchId = query.patch_id;
|
|
9149
9149
|
if (!patchId && isHttpOps(serverOps) && remote) {
|
|
9150
|
-
|
|
9150
|
+
core.Internal.log.error(`Remote file: ${filePath} requested without patch id. This is most likely a bug in Val.`);
|
|
9151
9151
|
}
|
|
9152
9152
|
// Opened, not read: a video is seeked in by many small ranges, and
|
|
9153
9153
|
// only the asked-for bytes are read where the mode can (fs).
|
|
@@ -9379,7 +9379,7 @@ async function withAuth(verifyJwt, secret, cookies, errorMessageType, handler) {
|
|
|
9379
9379
|
};
|
|
9380
9380
|
}
|
|
9381
9381
|
return handler(verification.data).catch(err => {
|
|
9382
|
-
|
|
9382
|
+
core.Internal.log.error(`Failed while processing: ${errorMessageType}`, err);
|
|
9383
9383
|
return {
|
|
9384
9384
|
status: 500,
|
|
9385
9385
|
json: {
|
|
@@ -9948,7 +9948,7 @@ class ValOpsMemory extends ValOps {
|
|
|
9948
9948
|
this.contentUrl = options.contentUrl;
|
|
9949
9949
|
this.requiresAuth = !options.unsafelyAllowUnauthenticated;
|
|
9950
9950
|
if (options.unsafelyAllowUnauthenticated && options.warnUnauthenticated !== false) {
|
|
9951
|
-
|
|
9951
|
+
core.Internal.log.warn("serving memory mode WITHOUT authentication. Every request that " + "reaches this server may read content, create patches and trigger a " + "publish. Only correct if the host authorises requests before they " + "get here.");
|
|
9952
9952
|
}
|
|
9953
9953
|
this.sourceFiles = Object.fromEntries(Object.entries(options.sourceFiles).map(([path, text]) => [ValOpsMemory.key(path), text]));
|
|
9954
9954
|
}
|
|
@@ -10450,7 +10450,7 @@ function createValRequestHandler(route, valServerPromise, convert, serveStatic)
|
|
|
10450
10450
|
message: "Val: could not start the Val server",
|
|
10451
10451
|
details: err instanceof Error ? err.message : String(err)
|
|
10452
10452
|
};
|
|
10453
|
-
|
|
10453
|
+
core.Internal.log.error(error.message + ": " + error.details);
|
|
10454
10454
|
return convert({
|
|
10455
10455
|
status: 500,
|
|
10456
10456
|
json: error
|
|
@@ -10462,7 +10462,7 @@ function createValRequestHandler(route, valServerPromise, convert, serveStatic)
|
|
|
10462
10462
|
message: "Val: routes are not configured correctly",
|
|
10463
10463
|
details: `Check you api routes. Expected pathname to start with "${route}", but it was: "${url.pathname}"`
|
|
10464
10464
|
};
|
|
10465
|
-
|
|
10465
|
+
core.Internal.log.error(error);
|
|
10466
10466
|
return convert({
|
|
10467
10467
|
status: 500,
|
|
10468
10468
|
json: error
|
|
@@ -10653,7 +10653,7 @@ function createValRequestHandler(route, valServerPromise, convert, serveStatic)
|
|
|
10653
10653
|
});
|
|
10654
10654
|
} catch (err) {
|
|
10655
10655
|
const error = err instanceof Error ? err : new Error(String(err));
|
|
10656
|
-
|
|
10656
|
+
core.Internal.log.error(`${method} ${route} threw: ${error.message}`, error.stack);
|
|
10657
10657
|
return {
|
|
10658
10658
|
status: 500,
|
|
10659
10659
|
json: {
|
package/dist/{getJsonEntryAtCommit-2e36e805.cjs.prod.js → getJsonEntryAtCommit-2a0e9eaf.cjs.prod.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var ts = require('typescript');
|
|
4
|
-
var ValRouterCore = require('./ValRouterCore-
|
|
4
|
+
var ValRouterCore = require('./ValRouterCore-dd465930.cjs.prod.js');
|
|
5
5
|
var fp = require('@valbuild/core/fp');
|
|
6
6
|
var jsonValuesModule = require('./jsonValuesModule-d1bb8d8f.cjs.prod.js');
|
|
7
7
|
require('@valbuild/core');
|
package/dist/{getJsonEntryAtCommit-64f67a50.cjs.dev.js → getJsonEntryAtCommit-85159574.cjs.dev.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var ts = require('typescript');
|
|
4
|
-
var ValRouterCore = require('./ValRouterCore-
|
|
4
|
+
var ValRouterCore = require('./ValRouterCore-72594062.cjs.dev.js');
|
|
5
5
|
var fp = require('@valbuild/core/fp');
|
|
6
6
|
var jsonValuesModule = require('./jsonValuesModule-8ae503a8.cjs.dev.js');
|
|
7
7
|
require('@valbuild/core');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
import { F as bytesToUtf8, G as posixPath } from './ValRouterCore-
|
|
2
|
+
import { F as bytesToUtf8, G as posixPath } from './ValRouterCore-ad10b6cf.esm.js';
|
|
3
3
|
import { result } from '@valbuild/core/fp';
|
|
4
4
|
import { a as analyzeValModule, c as analyzeJsonValuesEntries } from './jsonValuesModule-427d68c8.esm.js';
|
|
5
5
|
import '@valbuild/core';
|
|
@@ -12,7 +12,7 @@ var path = require('path');
|
|
|
12
12
|
var fs = require('fs');
|
|
13
13
|
var vm = require('node:vm');
|
|
14
14
|
var node_module = require('node:module');
|
|
15
|
-
var ValRouterCore = require('./ValRouterCore-
|
|
15
|
+
var ValRouterCore = require('./ValRouterCore-72594062.cjs.dev.js');
|
|
16
16
|
var server = require('@valbuild/ui/server');
|
|
17
17
|
var z = require('zod');
|
|
18
18
|
var zodValidationError = require('zod-validation-error');
|
|
@@ -2551,7 +2551,7 @@ class ValOpsFS extends ValRouterCore.ValOps {
|
|
|
2551
2551
|
}
|
|
2552
2552
|
};
|
|
2553
2553
|
}
|
|
2554
|
-
|
|
2554
|
+
core.Internal.log.error("Could not parse presigned auth nonce response. Error: " + zodValidationError.fromError(parsed.error));
|
|
2555
2555
|
return {
|
|
2556
2556
|
status: "error",
|
|
2557
2557
|
statusCode: 500,
|
|
@@ -2570,7 +2570,7 @@ class ValOpsFS extends ValRouterCore.ValOps {
|
|
|
2570
2570
|
};
|
|
2571
2571
|
}
|
|
2572
2572
|
const unknownErrorMessage = `Could not get presigned auth nonce. HTTP error: ${res.status} ${res.statusText}`;
|
|
2573
|
-
|
|
2573
|
+
core.Internal.log.error(unknownErrorMessage);
|
|
2574
2574
|
return {
|
|
2575
2575
|
status: "error",
|
|
2576
2576
|
statusCode: 500,
|
|
@@ -2579,7 +2579,7 @@ class ValOpsFS extends ValRouterCore.ValOps {
|
|
|
2579
2579
|
}
|
|
2580
2580
|
};
|
|
2581
2581
|
} catch (e) {
|
|
2582
|
-
|
|
2582
|
+
core.Internal.log.error("Could not get presigned auth nonce (connection error?):", e);
|
|
2583
2583
|
return {
|
|
2584
2584
|
status: "error",
|
|
2585
2585
|
statusCode: 500,
|
|
@@ -2684,7 +2684,7 @@ class ValOpsFS extends ValRouterCore.ValOps {
|
|
|
2684
2684
|
}
|
|
2685
2685
|
}
|
|
2686
2686
|
if (Date.now() - start > interval) {
|
|
2687
|
-
|
|
2687
|
+
core.Internal.log.debug("polling interval of patches exceeded");
|
|
2688
2688
|
}
|
|
2689
2689
|
if (stopPolling) {
|
|
2690
2690
|
return;
|
|
@@ -2713,7 +2713,7 @@ class ValOpsFS extends ValRouterCore.ValOps {
|
|
|
2713
2713
|
}
|
|
2714
2714
|
}
|
|
2715
2715
|
if (Date.now() - start > interval) {
|
|
2716
|
-
|
|
2716
|
+
core.Internal.log.debug("polling interval of files exceeded");
|
|
2717
2717
|
}
|
|
2718
2718
|
// Checked BEFORE rescheduling, as the patches-directory poller
|
|
2719
2719
|
// above does. Without it this walk goes on forever: the `finally`
|
|
@@ -2884,7 +2884,7 @@ class ValOpsFS extends ValRouterCore.ValOps {
|
|
|
2884
2884
|
async repairStore(read) {
|
|
2885
2885
|
const patchesDir = this.getPatchesDir();
|
|
2886
2886
|
for (const problem of describePatchStoreProblems(read.problems)) {
|
|
2887
|
-
|
|
2887
|
+
core.Internal.log.warn("something is wrong with the patch store.", problem);
|
|
2888
2888
|
}
|
|
2889
2889
|
const locked = await withPatchLock(this.getPatchLockFile(), {
|
|
2890
2890
|
ttlMs: 30_000,
|
|
@@ -2908,7 +2908,7 @@ class ValOpsFS extends ValRouterCore.ValOps {
|
|
|
2908
2908
|
}
|
|
2909
2909
|
for (const action of repairPatchStore(patchesDir, current)) {
|
|
2910
2910
|
if (action.type === "removed-unreadable-patch") {
|
|
2911
|
-
|
|
2911
|
+
core.Internal.log.warn(`removed the unpublished change ${action.name} because ${action.because}. See ${patchesDir}/${PATCH_REPAIR_LOG_FILE_NAME}.`);
|
|
2912
2912
|
// Queued rather than only logged: this is someone's unpublished
|
|
2913
2913
|
// work being thrown away, and a server console is not somewhere the
|
|
2914
2914
|
// person editing is looking.
|
|
@@ -2919,7 +2919,7 @@ class ValOpsFS extends ValRouterCore.ValOps {
|
|
|
2919
2919
|
} else if (action.type === "removed-orphan-directory") {
|
|
2920
2920
|
// Not queued. Nothing ever read this - it is a record whose log line
|
|
2921
2921
|
// never landed - so there is no edit to tell anyone about.
|
|
2922
|
-
|
|
2922
|
+
core.Internal.log.warn(`removed the unused patch directory ${action.name}.`);
|
|
2923
2923
|
}
|
|
2924
2924
|
}
|
|
2925
2925
|
const after = readPatchStore(patchesDir);
|
|
@@ -2939,7 +2939,7 @@ class ValOpsFS extends ValRouterCore.ValOps {
|
|
|
2939
2939
|
message: reset.error
|
|
2940
2940
|
};
|
|
2941
2941
|
}
|
|
2942
|
-
|
|
2942
|
+
core.Internal.log.warn(`the patch store could not be repaired, so it was reset. The previous contents are in ${reset.movedTo}.`);
|
|
2943
2943
|
return {
|
|
2944
2944
|
status: "ok",
|
|
2945
2945
|
entries: []
|
|
@@ -2949,7 +2949,7 @@ class ValOpsFS extends ValRouterCore.ValOps {
|
|
|
2949
2949
|
// Someone else holds the lock, quite possibly to run this same repair.
|
|
2950
2950
|
// Serving what was read is safe — those entries are the ones that ARE
|
|
2951
2951
|
// readable — and the next read tries again.
|
|
2952
|
-
|
|
2952
|
+
core.Internal.log.warn(`could not repair the patch store now. ${locked.message}`);
|
|
2953
2953
|
return {
|
|
2954
2954
|
status: "ok",
|
|
2955
2955
|
entries: read.entries
|
|
@@ -3460,7 +3460,7 @@ class ValOpsFS extends ValRouterCore.ValOps {
|
|
|
3460
3460
|
}
|
|
3461
3461
|
const res = await ValRouterCore.uploadRemoteFile(this.contentUrl, this.options.config.project, splitRemoteRefRes.bucket, splitRemoteRefRes.fileHash, ValRouterCore.getFileExt(splitRemoteRefRes.filePath), fileBuffer, auth);
|
|
3462
3462
|
if (!res.success) {
|
|
3463
|
-
|
|
3463
|
+
core.Internal.log.error("Failed to upload remote file", ref, res.error);
|
|
3464
3464
|
throw new Error(`Failed to upload remote file: ${ref}. ${res.error}`);
|
|
3465
3465
|
}
|
|
3466
3466
|
uploadedRemoteRefs.push(ref);
|
|
@@ -6440,7 +6440,7 @@ class ValOpsHttp extends ValRouterCore.ValOps {
|
|
|
6440
6440
|
}
|
|
6441
6441
|
};
|
|
6442
6442
|
} else {
|
|
6443
|
-
|
|
6443
|
+
core.Internal.log.error("Could not parse presigned auth nonce response. Error: " + zodValidationError.fromError(parsed.error));
|
|
6444
6444
|
return {
|
|
6445
6445
|
status: "error",
|
|
6446
6446
|
statusCode: 500,
|
|
@@ -6463,7 +6463,7 @@ class ValOpsHttp extends ValRouterCore.ValOps {
|
|
|
6463
6463
|
if ((_res$headers$get = res.headers.get("Content-Type")) !== null && _res$headers$get !== void 0 && _res$headers$get.includes("application/json")) {
|
|
6464
6464
|
const json = await res.json();
|
|
6465
6465
|
const message = internal.getErrorMessageFromUnknownJson(json, unknownErrorMessage);
|
|
6466
|
-
|
|
6466
|
+
core.Internal.log.error("Presigned auth nonce error:", message);
|
|
6467
6467
|
return {
|
|
6468
6468
|
status: "error",
|
|
6469
6469
|
statusCode: 500,
|
|
@@ -6472,7 +6472,7 @@ class ValOpsHttp extends ValRouterCore.ValOps {
|
|
|
6472
6472
|
}
|
|
6473
6473
|
};
|
|
6474
6474
|
}
|
|
6475
|
-
|
|
6475
|
+
core.Internal.log.error(unknownErrorMessage);
|
|
6476
6476
|
return {
|
|
6477
6477
|
status: "error",
|
|
6478
6478
|
statusCode: 500,
|
|
@@ -6481,7 +6481,7 @@ class ValOpsHttp extends ValRouterCore.ValOps {
|
|
|
6481
6481
|
}
|
|
6482
6482
|
};
|
|
6483
6483
|
} catch (e) {
|
|
6484
|
-
|
|
6484
|
+
core.Internal.log.error("Could not get presigned auth nonce (connection error?):", e);
|
|
6485
6485
|
return {
|
|
6486
6486
|
status: "error",
|
|
6487
6487
|
statusCode: 500,
|
|
@@ -6532,7 +6532,7 @@ class ValOpsHttp extends ValRouterCore.ValOps {
|
|
|
6532
6532
|
}
|
|
6533
6533
|
if (message) {
|
|
6534
6534
|
message = `Could not get patches: ${message}`;
|
|
6535
|
-
|
|
6535
|
+
core.Internal.log.error(message);
|
|
6536
6536
|
return {
|
|
6537
6537
|
type: "error",
|
|
6538
6538
|
error: {
|
|
@@ -6760,7 +6760,7 @@ class ValOpsHttp extends ValRouterCore.ValOps {
|
|
|
6760
6760
|
}
|
|
6761
6761
|
};
|
|
6762
6762
|
}).catch(e => {
|
|
6763
|
-
|
|
6763
|
+
core.Internal.log.error("Could not get nonce (connection error?):", e instanceof Error ? e.message : e.toString());
|
|
6764
6764
|
return {
|
|
6765
6765
|
status: "error",
|
|
6766
6766
|
error: {
|
|
@@ -6996,7 +6996,7 @@ class ValOpsHttp extends ValRouterCore.ValOps {
|
|
|
6996
6996
|
} : {})
|
|
6997
6997
|
};
|
|
6998
6998
|
}
|
|
6999
|
-
|
|
6999
|
+
core.Internal.log.error("Could not parse patches response. Error: " + zodValidationError.fromError(parsed.error));
|
|
7000
7000
|
return {
|
|
7001
7001
|
patches,
|
|
7002
7002
|
error: {
|
|
@@ -7004,7 +7004,7 @@ class ValOpsHttp extends ValRouterCore.ValOps {
|
|
|
7004
7004
|
}
|
|
7005
7005
|
};
|
|
7006
7006
|
}
|
|
7007
|
-
|
|
7007
|
+
core.Internal.log.error("Could not get patches. HTTP error: " + patchesRes.status + " " + patchesRes.statusText);
|
|
7008
7008
|
if (patchesRes.status === 401) {
|
|
7009
7009
|
return {
|
|
7010
7010
|
patches,
|
|
@@ -7020,7 +7020,7 @@ class ValOpsHttp extends ValRouterCore.ValOps {
|
|
|
7020
7020
|
}
|
|
7021
7021
|
};
|
|
7022
7022
|
} catch (err) {
|
|
7023
|
-
|
|
7023
|
+
core.Internal.log.error("Could not get patches (connection error):", err instanceof Error ? err.message : JSON.stringify(err));
|
|
7024
7024
|
return {
|
|
7025
7025
|
patches: [],
|
|
7026
7026
|
networkError: true,
|
|
@@ -7286,7 +7286,7 @@ class ValOpsHttp extends ValRouterCore.ValOps {
|
|
|
7286
7286
|
}
|
|
7287
7287
|
const file = filesRes.files[0];
|
|
7288
7288
|
if (filesRes.files.length > 1) {
|
|
7289
|
-
|
|
7289
|
+
core.Internal.log.error("Expected 1 file, got more:", filesRes.files);
|
|
7290
7290
|
}
|
|
7291
7291
|
if (!file) {
|
|
7292
7292
|
return null;
|
|
@@ -7301,15 +7301,15 @@ class ValOpsHttp extends ValRouterCore.ValOps {
|
|
|
7301
7301
|
remote
|
|
7302
7302
|
}]);
|
|
7303
7303
|
if (filesRes.error) {
|
|
7304
|
-
|
|
7304
|
+
core.Internal.log.error("Error getting file:", filePath, filesRes.error);
|
|
7305
7305
|
return null;
|
|
7306
7306
|
}
|
|
7307
7307
|
if (filesRes.errors) {
|
|
7308
|
-
|
|
7308
|
+
core.Internal.log.error("Failed while retrieving files", filePath, filesRes.errors);
|
|
7309
7309
|
}
|
|
7310
7310
|
const file = filesRes.files[0];
|
|
7311
7311
|
if (filesRes.files.length > 1) {
|
|
7312
|
-
|
|
7312
|
+
core.Internal.log.error("Expected 1 file, got more:", filesRes.files);
|
|
7313
7313
|
}
|
|
7314
7314
|
if (!file) {
|
|
7315
7315
|
return null;
|
|
@@ -8484,7 +8484,7 @@ function warnIfInsecureUrls(urls) {
|
|
|
8484
8484
|
for (const name of CREDENTIAL_BEARING_URLS) {
|
|
8485
8485
|
const warning = insecureUrlWarning(name, urls[name]);
|
|
8486
8486
|
if (warning) {
|
|
8487
|
-
|
|
8487
|
+
core.Internal.log.warn(warning);
|
|
8488
8488
|
}
|
|
8489
8489
|
}
|
|
8490
8490
|
}
|
|
@@ -8612,7 +8612,7 @@ const CLOCK_SKEW_LEEWAY_SECONDS = 60;
|
|
|
8612
8612
|
function failure(reason, message) {
|
|
8613
8613
|
// NOTE: deliberately never logs the token itself - it is a credential, and
|
|
8614
8614
|
// anything we print here ends up in the host's request logs.
|
|
8615
|
-
|
|
8615
|
+
core.Internal.log.debug(`Invalid JWT (${reason}): ${message}`);
|
|
8616
8616
|
return {
|
|
8617
8617
|
success: false,
|
|
8618
8618
|
reason,
|
|
@@ -8994,7 +8994,7 @@ function guardedLookup(lookup) {
|
|
|
8994
8994
|
// Server-side only. This is the half an operator needs to work out
|
|
8995
8995
|
// why a link check refused a URL, and the half a caller must not
|
|
8996
8996
|
// be given.
|
|
8997
|
-
|
|
8997
|
+
core.Internal.log.warn(`[val] link check refused ${hostname}: resolves to ${describeBlocked(reason)} (${entry.address})`);
|
|
8998
8998
|
callback(new Error(REFUSED_MESSAGE), "", 0);
|
|
8999
8999
|
return;
|
|
9000
9000
|
}
|
|
@@ -13524,7 +13524,7 @@ async function safeReadGit(cwd) {
|
|
|
13524
13524
|
async function findGitHead(currentDir, depth) {
|
|
13525
13525
|
const gitHeadPath = path.join(currentDir, ".git", "HEAD");
|
|
13526
13526
|
if (depth > 1000) {
|
|
13527
|
-
|
|
13527
|
+
core.Internal.log.error(`Reached max depth while scanning for .git folder. Current working dir: ${cwd}.`);
|
|
13528
13528
|
return {
|
|
13529
13529
|
commit: undefined,
|
|
13530
13530
|
branch: undefined
|
|
@@ -13561,7 +13561,7 @@ async function safeReadGit(cwd) {
|
|
|
13561
13561
|
try {
|
|
13562
13562
|
return findGitHead(cwd, 0);
|
|
13563
13563
|
} catch (err) {
|
|
13564
|
-
|
|
13564
|
+
core.Internal.log.error("Error while reading .git", err);
|
|
13565
13565
|
return {
|
|
13566
13566
|
commit: undefined,
|
|
13567
13567
|
branch: undefined
|
|
@@ -13642,7 +13642,7 @@ class ValModuleLoader {
|
|
|
13642
13642
|
}).code;
|
|
13643
13643
|
if (!this.disableCache) {
|
|
13644
13644
|
if (this.cacheSize > MAX_CACHE_SIZE) {
|
|
13645
|
-
|
|
13645
|
+
core.Internal.log.debug("Cache size exceeded, clearing cache");
|
|
13646
13646
|
this.cache = {};
|
|
13647
13647
|
this.cacheSize = 0;
|
|
13648
13648
|
}
|
|
@@ -15194,7 +15194,7 @@ async function replaySnapshot(snapshotDir) {
|
|
|
15194
15194
|
}
|
|
15195
15195
|
if (patchesRes.errors && patchesRes.errors.length > 0) {
|
|
15196
15196
|
for (const err of patchesRes.errors) {
|
|
15197
|
-
|
|
15197
|
+
core.Internal.log.error(`Snapshot patch could not be read: ${err.message}`);
|
|
15198
15198
|
}
|
|
15199
15199
|
}
|
|
15200
15200
|
const analysis = {
|