@heroku/plugin-compute 0.4.1 → 0.4.3
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/commands/compute/get/runtime-log.js +19 -11
- package/dist/commands/compute/get/runtime-log.js.map +1 -1
- package/dist/commands/compute/tail/runtime-log.js +49 -8
- package/dist/commands/compute/tail/runtime-log.js.map +1 -1
- package/dist/shared/computeBundle.js +14 -13
- package/dist/shared/computeBundle.js.map +1 -1
- package/dist/shared/computeConnectApi.js +4 -3
- package/dist/shared/computeConnectApi.js.map +1 -1
- package/dist/shared/computeLogFollow.d.ts +32 -0
- package/dist/shared/computeLogFollow.js +92 -0
- package/dist/shared/computeLogFollow.js.map +1 -0
- package/dist/shared/computeLogStream.d.ts +11 -3
- package/dist/shared/computeLogStream.js +129 -25
- package/dist/shared/computeLogStream.js.map +1 -1
- package/messages/compute.get.runtime-log.md +6 -9
- package/messages/compute.tail.runtime-log.md +20 -0
- package/npm-shrinkwrap.json +2 -2
- package/oclif.manifest.json +2 -2
- package/package.json +1 -1
|
@@ -16,12 +16,15 @@
|
|
|
16
16
|
import { Messages } from '@salesforce/core';
|
|
17
17
|
import { Flags, SfCommand } from '@salesforce/sf-plugins-core';
|
|
18
18
|
import { requireAppName, resolveComputeAppNameFromDir, validateName } from '../../../shared/computeApp.js';
|
|
19
|
-
import { fetchLogplexOutput } from '../../../shared/computeLogStream.js';
|
|
19
|
+
import { fetchLogplexOutput, LOGPLEX_FETCH_TIMEOUT_MS } from '../../../shared/computeLogStream.js';
|
|
20
20
|
import { queryComputeApp, requireHerokuAppId, toComputeAppSummary } from '../../../shared/computeQuery.js';
|
|
21
21
|
import { createComputeLogSessionViaProxy, fetchComputeAppViaProxy } from '../../../shared/herokuProxyApi.js';
|
|
22
22
|
import { PLUGIN_NAME } from '../../../shared/plugin-name.js';
|
|
23
23
|
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
24
24
|
const messages = Messages.loadMessages(PLUGIN_NAME, 'compute.get.runtime-log');
|
|
25
|
+
// How long a Fir log session may stay silent before the one-shot read treats the buffered output as
|
|
26
|
+
// complete. Long enough to cover session setup and the initial backfill, short enough to feel instant.
|
|
27
|
+
const FIR_IDLE_MS = 3000;
|
|
25
28
|
// Drops the single trailing empty element split('\n') produces when the text ends in a newline,
|
|
26
29
|
// without dropping genuine blank lines in the middle of the output.
|
|
27
30
|
function splitLines(text) {
|
|
@@ -63,18 +66,23 @@ export default class RuntimeLog extends SfCommand {
|
|
|
63
66
|
return { name };
|
|
64
67
|
}
|
|
65
68
|
const appId = requireHerokuAppId(record, name);
|
|
66
|
-
// Fir apps keep no log history -- their session URL is a live stream that never closes -- so
|
|
67
|
-
//
|
|
68
|
-
//
|
|
69
|
-
// let session creation surface
|
|
69
|
+
// Fir apps keep no log history -- their session URL is a live stream that never closes -- so a
|
|
70
|
+
// one-shot read can't wait for EOF; it drains whatever is buffered and stops once the stream
|
|
71
|
+
// goes idle. The lookup only picks the read mode: if it fails, or the generation is unknown, fall
|
|
72
|
+
// through to the Cedar path (the fetch timeout still bounds it) and let session creation surface
|
|
73
|
+
// any real proxy failure -- but say so, since a Fir app read that way waits out the full timeout.
|
|
70
74
|
const herokuApp = await fetchComputeAppViaProxy(connection, { appId, name }).catch(() => undefined);
|
|
71
|
-
if (herokuApp?.generation ===
|
|
72
|
-
|
|
75
|
+
if (herokuApp?.generation === undefined) {
|
|
76
|
+
this.warn(messages.getMessage('warning.generationUnknown', [name]));
|
|
73
77
|
}
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
+
const isFir = herokuApp?.generation === 'fir';
|
|
79
|
+
// Fir sessions take no line count or tail flag -- they are always a live stream.
|
|
80
|
+
const session = await createComputeLogSessionViaProxy(connection, isFir
|
|
81
|
+
? { name, appId }
|
|
82
|
+
: {
|
|
83
|
+
name, appId, lines: num, tail: false,
|
|
84
|
+
});
|
|
85
|
+
const { output, timedOut } = await fetchLogplexOutput(session.logplexUrl, LOGPLEX_FETCH_TIMEOUT_MS, isFir ? { idleMs: FIR_IDLE_MS, sse: true } : {});
|
|
78
86
|
const lines = splitLines(output);
|
|
79
87
|
if (lines.length === 0) {
|
|
80
88
|
this.info(messages.getMessage('info.noLogLines', [name]));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-log.js","sourceRoot":"","sources":["../../../../src/commands/compute/get/runtime-log.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAC,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAC,KAAK,EAAE,SAAS,EAAC,MAAM,6BAA6B,CAAC;AAE7D,OAAO,EAAC,cAAc,EAAE,4BAA4B,EAAE,YAAY,EAAC,MAAM,+BAA+B,CAAC;AACzG,OAAO,EAAC,kBAAkB,EAAC,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"runtime-log.js","sourceRoot":"","sources":["../../../../src/commands/compute/get/runtime-log.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAC,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAC,KAAK,EAAE,SAAS,EAAC,MAAM,6BAA6B,CAAC;AAE7D,OAAO,EAAC,cAAc,EAAE,4BAA4B,EAAE,YAAY,EAAC,MAAM,+BAA+B,CAAC;AACzG,OAAO,EAAC,kBAAkB,EAAE,wBAAwB,EAAC,MAAM,qCAAqC,CAAC;AACjG,OAAO,EAAC,eAAe,EAAE,kBAAkB,EAAE,mBAAmB,EAAC,MAAM,iCAAiC,CAAC;AACzG,OAAO,EAAC,+BAA+B,EAAE,uBAAuB,EAAC,MAAM,mCAAmC,CAAC;AAC3G,OAAO,EAAC,WAAW,EAAC,MAAM,gCAAgC,CAAC;AAE3D,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,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AAC,CAAC;QACtE,CAAC;QAED,MAAM,KAAK,GAAG,SAAS,EAAE,UAAU,KAAK,KAAK,CAAC;QAE9C,iFAAiF;QACjF,MAAM,OAAO,GAAG,MAAM,+BAA+B,CACnD,UAAU,EACV,KAAK;YACH,CAAC,CAAC,EAAC,IAAI,EAAE,KAAK,EAAC;YACf,CAAC,CAAC;gBACA,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK;aACrC,CACJ,CAAC;QAEF,MAAM,EAAC,MAAM,EAAE,QAAQ,EAAC,GAAG,MAAM,kBAAkB,CACjD,OAAO,CAAC,UAAU,EAClB,wBAAwB,EACxB,KAAK,CAAC,CAAC,CAAC,EAAC,MAAM,EAAE,WAAW,EAAE,GAAG,EAAE,IAAI,EAAC,CAAC,CAAC,CAAC,EAAE,CAC9C,CAAC;QACF,MAAM,KAAK,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;QACjC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACvB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,iBAAiB,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAC1D,OAAO,EAAC,IAAI,EAAC,CAAC;QAChB,CAAC;QAED,KAAK,MAAM,IAAI,IAAI,KAAK;YAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,QAAQ;YAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,yBAAyB,CAAC,CAAC,CAAC;QACxE,OAAO,EAAC,IAAI,EAAE,KAAK,EAAC,CAAC;IACvB,CAAC"}
|
|
@@ -16,9 +16,10 @@
|
|
|
16
16
|
import { Messages } from '@salesforce/core';
|
|
17
17
|
import { Flags, SfCommand } from '@salesforce/sf-plugins-core';
|
|
18
18
|
import { requireAppName, resolveComputeAppNameFromDir, validateName } from '../../../shared/computeApp.js';
|
|
19
|
+
import { followFirLogSession } from '../../../shared/computeLogFollow.js';
|
|
19
20
|
import { streamLogplexOutput } from '../../../shared/computeLogStream.js';
|
|
20
21
|
import { queryComputeApp, requireHerokuAppId, toComputeAppSummary } from '../../../shared/computeQuery.js';
|
|
21
|
-
import { createComputeLogSessionViaProxy } from '../../../shared/herokuProxyApi.js';
|
|
22
|
+
import { createComputeLogSessionViaProxy, fetchComputeAppViaProxy } from '../../../shared/herokuProxyApi.js';
|
|
22
23
|
import { PLUGIN_NAME } from '../../../shared/plugin-name.js';
|
|
23
24
|
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
24
25
|
const messages = Messages.loadMessages(PLUGIN_NAME, 'compute.tail.runtime-log');
|
|
@@ -57,9 +58,21 @@ export default class TailRuntimeLog extends SfCommand {
|
|
|
57
58
|
return { name };
|
|
58
59
|
}
|
|
59
60
|
const appId = requireHerokuAppId(record, name);
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
// Fir sessions are SSE streams with their own framing and a server-side lifetime. The lookup
|
|
62
|
+
// only picks the read mode: if it fails, fall back to the Cedar path and let session creation
|
|
63
|
+
// surface any real proxy failure -- but say so, since a Fir app read that way can show nothing.
|
|
64
|
+
const herokuApp = await fetchComputeAppViaProxy(connection, { appId, name }).catch(() => undefined);
|
|
65
|
+
if (herokuApp?.generation === undefined) {
|
|
66
|
+
this.warn(messages.getMessage('warning.generationUnknown', [name]));
|
|
67
|
+
}
|
|
68
|
+
const isFir = herokuApp?.generation === 'fir';
|
|
69
|
+
// Fir sessions take no line count or tail flag -- they are always a live stream.
|
|
70
|
+
const sessionParams = isFir
|
|
71
|
+
? { name, appId }
|
|
72
|
+
: {
|
|
73
|
+
name, appId, lines: num, tail: true,
|
|
74
|
+
};
|
|
75
|
+
const session = await createComputeLogSessionViaProxy(connection, sessionParams);
|
|
63
76
|
this.info(messages.getMessage('info.tailStarting', [name]));
|
|
64
77
|
const controller = new AbortController();
|
|
65
78
|
// SfCommand._run() registers SIGINT listeners that throw ExitError from inside the signal
|
|
@@ -73,11 +86,39 @@ export default class TailRuntimeLog extends SfCommand {
|
|
|
73
86
|
controller.abort();
|
|
74
87
|
});
|
|
75
88
|
let wasAborted;
|
|
89
|
+
let lineCount = 0;
|
|
90
|
+
const onLine = (line) => {
|
|
91
|
+
lineCount++;
|
|
92
|
+
this.log(line);
|
|
93
|
+
};
|
|
76
94
|
try {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
95
|
+
if (isFir) {
|
|
96
|
+
const result = await followFirLogSession({
|
|
97
|
+
createSession: async () => createComputeLogSessionViaProxy(connection, sessionParams),
|
|
98
|
+
initialSession: session,
|
|
99
|
+
onLine,
|
|
100
|
+
onNotice: notice => {
|
|
101
|
+
if (notice.kind === 'retrying') {
|
|
102
|
+
this.info(messages.getMessage('info.tailRetrying', [
|
|
103
|
+
name, notice.reason, String(notice.delayMs / 1000), String(notice.attempt), String(notice.max),
|
|
104
|
+
]));
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
this.info(messages.getMessage(notice.kind === 'stalled' ? 'info.tailStalled' : 'info.tailReconnecting', [name]));
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
signal: controller.signal,
|
|
111
|
+
});
|
|
112
|
+
wasAborted = result === 'aborted';
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
wasAborted = (await streamLogplexOutput(session.logplexUrl, onLine, controller.signal)) === 'aborted';
|
|
116
|
+
}
|
|
117
|
+
if (isFir && !wasAborted && lineCount === 0) {
|
|
118
|
+
// A session that closes without a single line is indistinguishable from "nothing happened"
|
|
119
|
+
// unless we say so -- surface it rather than exiting silently.
|
|
120
|
+
this.warn(messages.getMessage('warning.tailEndedWithoutOutput', [name]));
|
|
121
|
+
}
|
|
81
122
|
this.info(wasAborted
|
|
82
123
|
? messages.getMessage('info.tailStopped', [name])
|
|
83
124
|
: messages.getMessage('info.tailStreamEnded', [name]));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-log.js","sourceRoot":"","sources":["../../../../src/commands/compute/tail/runtime-log.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAC,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAC,KAAK,EAAE,SAAS,EAAC,MAAM,6BAA6B,CAAC;AAE7D,OAAO,EAAC,cAAc,EAAE,4BAA4B,EAAE,YAAY,EAAC,MAAM,+BAA+B,CAAC;AACzG,OAAO,EAAC,mBAAmB,EAAC,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAC,eAAe,EAAE,kBAAkB,EAAE,mBAAmB,EAAC,MAAM,iCAAiC,CAAC;AACzG,OAAO,EAAC,+BAA+B,EAAC,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"runtime-log.js","sourceRoot":"","sources":["../../../../src/commands/compute/tail/runtime-log.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAC,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAC,KAAK,EAAE,SAAS,EAAC,MAAM,6BAA6B,CAAC;AAE7D,OAAO,EAAC,cAAc,EAAE,4BAA4B,EAAE,YAAY,EAAC,MAAM,+BAA+B,CAAC;AACzG,OAAO,EAAC,mBAAmB,EAAC,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAC,mBAAmB,EAAC,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAC,eAAe,EAAE,kBAAkB,EAAE,mBAAmB,EAAC,MAAM,iCAAiC,CAAC;AACzG,OAAO,EAAC,+BAA+B,EAAE,uBAAuB,EAAC,MAAM,mCAAmC,CAAC;AAC3G,OAAO,EAAC,WAAW,EAAC,MAAM,gCAAgC,CAAC;AAE3D,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ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B,CAAC;QAED,OAAO,EAAC,IAAI,EAAC,CAAC;IAChB,CAAC"}
|
|
@@ -60,20 +60,23 @@ export async function packageComputeBundle(appDir, name, projectRoot) {
|
|
|
60
60
|
debug('packaged %s into %d bytes (%d files)', appDir, buffer.length, sourceEntries.length);
|
|
61
61
|
return { buffer, fileCount: sourceEntries.length };
|
|
62
62
|
}
|
|
63
|
-
//
|
|
64
|
-
//
|
|
65
|
-
//
|
|
63
|
+
// Writes every file in the downloaded source.tar.gz into appDir. The download endpoint returns
|
|
64
|
+
// that inner tarball directly (api-spec.yaml included), unlike the nested bundle packageComputeBundle
|
|
65
|
+
// uploads -- the asymmetry is deliberate: the appserver inspects the upload's top-level files
|
|
66
|
+
// without untarring the source. Used by sf compute source retrieve, the only caller that needs
|
|
67
|
+
// to go this direction.
|
|
66
68
|
export async function unpackComputeBundle(buffer, appDir) {
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
if (
|
|
69
|
+
const sourceEntries = await untarGzip(buffer);
|
|
70
|
+
// Release ordering alone doesn't protect against an org still returning the old nested bundle
|
|
71
|
+
// (api-spec.yaml + source.tar.gz), which would otherwise "succeed" with an unextracted blob.
|
|
72
|
+
if (Object.keys(sourceEntries).length === 0) {
|
|
73
|
+
throw messages.createError('error.sourceBundleMalformed', ['archive contains no files']);
|
|
74
|
+
}
|
|
75
|
+
if ('source.tar.gz' in sourceEntries) {
|
|
71
76
|
throw messages.createError('error.sourceBundleMalformed', [
|
|
72
|
-
|
|
77
|
+
'unexpected nested source.tar.gz (the org returned the older nested bundle shape)',
|
|
73
78
|
]);
|
|
74
79
|
}
|
|
75
|
-
await writeFile(join(appDir, 'api-spec.yaml'), apiSpec);
|
|
76
|
-
const sourceEntries = await untarGzip(sourceTarGz);
|
|
77
80
|
const resolvedAppDir = resolve(appDir);
|
|
78
81
|
await Promise.all(Object.entries(sourceEntries).map(async ([relativePath, data]) => {
|
|
79
82
|
const filePath = resolve(appDir, relativePath);
|
|
@@ -86,9 +89,7 @@ export async function unpackComputeBundle(buffer, appDir) {
|
|
|
86
89
|
await mkdir(dirname(filePath), { recursive: true });
|
|
87
90
|
await writeFile(filePath, data);
|
|
88
91
|
}));
|
|
89
|
-
|
|
90
|
-
// plugin carry api-spec.yaml in source.tar.gz too; older ones only had the outer copy.
|
|
91
|
-
return { fileCount: new Set([...Object.keys(sourceEntries), 'api-spec.yaml']).size };
|
|
92
|
+
return { fileCount: Object.keys(sourceEntries).length };
|
|
92
93
|
}
|
|
93
94
|
// Inverse of tarGzip below -- decompress and read every tar entry into memory, keyed by name.
|
|
94
95
|
// Wraps decompression/parse failures as error.sourceBundleMalformed rather than letting a raw
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computeBundle.js","sourceRoot":"","sources":["../../src/shared/computeBundle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,OAAO,EAAC,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAC1C,OAAO,MAAqB,MAAM,QAAQ,CAAC;AAC3C,OAAO,EACL,KAAK,EACL,OAAO,EACP,QAAQ,EACR,SAAS,GACV,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,OAAO,EACP,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,GAAG,GACJ,MAAM,WAAW,CAAC;AACnB,OAAO,EAAC,MAAM,IAAI,cAAc,EAAC,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAC,UAAU,EAAE,UAAU,EAAC,MAAM,WAAW,CAAC;AACjD,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAC,UAAU,EAAC,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAC,WAAW,EAAC,MAAM,kBAAkB,CAAC;AAE7C,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAA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,GAAG,MAAM,OAAO,CAAC,GAAG,CAC9B,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,EAAqB,EAAE;QAC7C,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QACnC,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;YACxB,OAAO,kBAAkB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACxC,CAAC;QAED,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;YACnB,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QACrD,CAAC;QAED,OAAO,EAAE,CAAC;IACZ,CAAC,CAAC,CACH,CAAC;IACF,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;AACvB,CAAC"}
|
|
@@ -41,15 +41,16 @@ export async function uploadComputeSource(connection, params) {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
// Speculative resource -- see the Compute tag description in salesforce-connect-compute.yaml.
|
|
44
|
-
// The
|
|
45
|
-
//
|
|
44
|
+
// The CLI always asks for the `latest` build (it has no build id); Heroku Builds pins a build id.
|
|
45
|
+
// The response body is the flat source.tar.gz (not the nested deployment-bundle.tar.gz
|
|
46
|
+
// uploadComputeSource sends), binary, so this must round-trip exact bytes. connection.request()'s default string decoding is UTF-8,
|
|
46
47
|
// which is lossy for arbitrary gzip bytes (any byte >0x7F gets re-encoded) -- passing
|
|
47
48
|
// { encoding: 'binary' } (Node's alias for latin1) as the second argument makes jsforce decode
|
|
48
49
|
// the response 1:1 into a string, which Buffer.from(str, 'binary') then turns back into the
|
|
49
50
|
// exact original bytes.
|
|
50
51
|
export async function downloadComputeSource(connection, params) {
|
|
51
52
|
try {
|
|
52
|
-
const body = await connection.request({ method: 'GET', url: `/connect/compute/${encodeURIComponent(params.appIdOrName)}/source` }, { encoding: 'binary' });
|
|
53
|
+
const body = await connection.request({ method: 'GET', url: `/connect/compute/${encodeURIComponent(params.appIdOrName)}/builds/latest/source` }, { encoding: 'binary' });
|
|
53
54
|
return Buffer.from(body, 'binary');
|
|
54
55
|
}
|
|
55
56
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computeConnectApi.js","sourceRoot":"","sources":["../../src/shared/computeConnectApi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAkB,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAC3D,OAAO,QAAQ,MAAM,WAAW,CAAC;AAIjC,OAAO,EAAC,WAAW,EAAC,MAAM,kBAAkB,CAAC;AAE7C,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC;AAYtE,iFAAiF;AACjF,yEAAyE;AACzE,yEAAyE;AACzE,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,UAAsB,EACtB,MAAiC;IAEjC,MAAM,IAAI,GAAG,IAAI,QAAQ,EAAE,CAAC;IAC5B,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;IACjC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE;QACnC,QAAQ,EAAE,0BAA0B;QACpC,WAAW,EAAE,kBAAkB;KAChC,CAAC,CAAC;IAEH,IAAI,CAAC;QACH,OAAO,MAAM,UAAU,CAAC,OAAO,CAAsB;YACnD,MAAM,EAAE,MAAM;YACd,GAAG,EAAE,yBAAyB;YAC9B,IAAI,EAAE,IAAI;YACV,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE;SAC3B,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CA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e,CAAC,OAAO,CAAC,CAAC,CAAC;IAC1F,CAAC;AACH,CAAC;AAOD,8FAA8F;AAC9F,kGAAkG;AAClG,uFAAuF;AACvF,oIAAoI;AACpI,sFAAsF;AACtF,+FAA+F;AAC/F,4FAA4F;AAC5F,wBAAwB;AACxB,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,UAAsB,EACtB,MAAmC;IAEnC,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC,OAAO,CACnC,EAAC,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,oBAAoB,kBAAkB,CAAC,MAAM,CAAC,WAAW,CAAC,uBAAuB,EAAC,EACvG,EAAC,QAAQ,EAAE,QAAQ,EAAC,CACrB,CAAC;QACF,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACrC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,QAAQ,CAAC,WAAW,CAAC,4BAA4B,EAAE,CAAE,KAAe,CAAC,OAAO,CAAC,CAAC,CAAC;IACvF,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export declare const MIN_FIR_SESSION_MS = 5000;
|
|
2
|
+
export declare const FIR_STALL_MS: number;
|
|
3
|
+
export declare const MAX_CONSECUTIVE_FAILURES = 5;
|
|
4
|
+
export type FollowNotice = {
|
|
5
|
+
attempt: number;
|
|
6
|
+
delayMs: number;
|
|
7
|
+
kind: 'retrying';
|
|
8
|
+
max: number;
|
|
9
|
+
reason: string;
|
|
10
|
+
} | {
|
|
11
|
+
kind: 'expired';
|
|
12
|
+
} | {
|
|
13
|
+
kind: 'stalled';
|
|
14
|
+
};
|
|
15
|
+
export type FollowOptions = {
|
|
16
|
+
createSession: () => Promise<{
|
|
17
|
+
logplexUrl: string;
|
|
18
|
+
}>;
|
|
19
|
+
initialSession: {
|
|
20
|
+
logplexUrl: string;
|
|
21
|
+
};
|
|
22
|
+
maxFailures?: number;
|
|
23
|
+
minSessionMs?: number;
|
|
24
|
+
onLine: (line: string) => void;
|
|
25
|
+
onNotice: (notice: FollowNotice) => void;
|
|
26
|
+
signal: AbortSignal;
|
|
27
|
+
sleep?: (ms: number, signal: AbortSignal) => Promise<void>;
|
|
28
|
+
stallMs?: number;
|
|
29
|
+
};
|
|
30
|
+
export type FollowResult = 'aborted' | 'gave-up';
|
|
31
|
+
export declare function backoffMs(failures: number): number;
|
|
32
|
+
export declare function followFirLogSession(options: FollowOptions): Promise<FollowResult>;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026, Salesforce, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { streamLogplexOutput } from './computeLogStream.js';
|
|
17
|
+
// A Fir session ends on its own: the server expires it (about 15 min), and a dropped connection or a
|
|
18
|
+
// silent half-open socket looks the same from here. Following means recreating the session each time,
|
|
19
|
+
// not treating the end as "done".
|
|
20
|
+
// A session that closes sooner than this was rejected or dropped, not expired, so it counts as a
|
|
21
|
+
// failure (with backoff) rather than a normal reconnect.
|
|
22
|
+
export const MIN_FIR_SESSION_MS = 5000;
|
|
23
|
+
// A stream silent this long without closing is treated as dead and recreated.
|
|
24
|
+
export const FIR_STALL_MS = 15 * 60_000;
|
|
25
|
+
// Consecutive failed sessions tolerated before giving up; any healthy session resets the count.
|
|
26
|
+
export const MAX_CONSECUTIVE_FAILURES = 5;
|
|
27
|
+
const BACKOFF_BASE_MS = 500;
|
|
28
|
+
const BACKOFF_MAX_MS = 5000;
|
|
29
|
+
export function backoffMs(failures) {
|
|
30
|
+
return Math.min(BACKOFF_BASE_MS * (2 ** (failures - 1)), BACKOFF_MAX_MS);
|
|
31
|
+
}
|
|
32
|
+
async function abortableSleep(ms, signal) {
|
|
33
|
+
return new Promise(resolve => {
|
|
34
|
+
const timer = setTimeout(done, ms);
|
|
35
|
+
function done() {
|
|
36
|
+
clearTimeout(timer);
|
|
37
|
+
signal.removeEventListener('abort', done);
|
|
38
|
+
resolve();
|
|
39
|
+
}
|
|
40
|
+
signal.addEventListener('abort', done, { once: true });
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
// Follows a Fir log session until the caller aborts or the sessions keep failing. Clean ends after a
|
|
44
|
+
// real run reconnect at once; early closes, creation failures and transport errors back off
|
|
45
|
+
// (500ms to 5s) and give up after `maxFailures` in a row, rethrowing the last error if there was one.
|
|
46
|
+
export async function followFirLogSession(options) {
|
|
47
|
+
const { createSession, maxFailures = MAX_CONSECUTIVE_FAILURES, minSessionMs = MIN_FIR_SESSION_MS, onLine, onNotice, signal, sleep = abortableSleep, stallMs = FIR_STALL_MS, } = options;
|
|
48
|
+
let session = options.initialSession;
|
|
49
|
+
let failures = 0;
|
|
50
|
+
while (!signal.aborted) {
|
|
51
|
+
let reason;
|
|
52
|
+
let error;
|
|
53
|
+
const startedAt = Date.now();
|
|
54
|
+
try {
|
|
55
|
+
// Session creation and reading share one failure budget, so a proxy outage backs off too.
|
|
56
|
+
// eslint-disable-next-line no-await-in-loop
|
|
57
|
+
session ??= await createSession();
|
|
58
|
+
// eslint-disable-next-line no-await-in-loop
|
|
59
|
+
reason = await streamLogplexOutput(session.logplexUrl, onLine, signal, { sse: true, stallMs });
|
|
60
|
+
}
|
|
61
|
+
catch (error_) {
|
|
62
|
+
error = error_;
|
|
63
|
+
}
|
|
64
|
+
if (reason === 'aborted' || signal.aborted) {
|
|
65
|
+
return 'aborted';
|
|
66
|
+
}
|
|
67
|
+
session = undefined;
|
|
68
|
+
const isRanLong = Date.now() - startedAt >= minSessionMs;
|
|
69
|
+
if (isRanLong) {
|
|
70
|
+
failures = 0;
|
|
71
|
+
if (reason !== undefined) {
|
|
72
|
+
onNotice({ kind: reason === 'stalled' ? 'stalled' : 'expired' });
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
failures++;
|
|
77
|
+
if (failures > maxFailures) {
|
|
78
|
+
if (error) {
|
|
79
|
+
throw error;
|
|
80
|
+
}
|
|
81
|
+
return 'gave-up';
|
|
82
|
+
}
|
|
83
|
+
const delayMs = backoffMs(failures);
|
|
84
|
+
onNotice({
|
|
85
|
+
attempt: failures, delayMs, kind: 'retrying', max: maxFailures, reason: error?.message ?? 'the session closed early',
|
|
86
|
+
});
|
|
87
|
+
// eslint-disable-next-line no-await-in-loop
|
|
88
|
+
await sleep(delayMs, signal);
|
|
89
|
+
}
|
|
90
|
+
return 'aborted';
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=computeLogFollow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"computeLogFollow.js","sourceRoot":"","sources":["../../src/shared/computeLogFollow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAuB,mBAAmB,EAAC,MAAM,uBAAuB,CAAC;AAEhF,qGAAqG;AACrG,sGAAsG;AACtG,kCAAkC;AAElC,iGAAiG;AACjG,yDAAyD;AACzD,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAC;AACvC,8EAA8E;AAC9E,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,GAAG,MAAM,CAAC;AACxC,gGAAgG;AAChG,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC;AAC1C,MAAM,eAAe,GAAG,GAAG,CAAC;AAC5B,MAA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O,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -3,7 +3,15 @@ export type LogplexSnapshot = {
|
|
|
3
3
|
output: string;
|
|
4
4
|
timedOut: boolean;
|
|
5
5
|
};
|
|
6
|
-
export
|
|
6
|
+
export type LogplexFetchOptions = {
|
|
7
|
+
idleMs?: number;
|
|
8
|
+
sse?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export declare function fetchLogplexOutput(logplexUrl: string, timeoutMs?: number, options?: LogplexFetchOptions): Promise<LogplexSnapshot>;
|
|
7
11
|
export declare function fetchBuildOutputStream(outputStreamUrl: string): Promise<string>;
|
|
8
|
-
export type StreamEndReason = 'aborted' | 'eof';
|
|
9
|
-
export
|
|
12
|
+
export type StreamEndReason = 'aborted' | 'eof' | 'stalled';
|
|
13
|
+
export type StreamLogplexOptions = Pick<LogplexFetchOptions, 'sse'> & {
|
|
14
|
+
onActivity?: () => void;
|
|
15
|
+
stallMs?: number;
|
|
16
|
+
};
|
|
17
|
+
export declare function streamLogplexOutput(logplexUrl: string, onLine: (line: string) => void, signal?: AbortSignal, options?: StreamLogplexOptions): Promise<StreamEndReason>;
|
|
@@ -24,21 +24,89 @@ const messages = Messages.loadMessages(PLUGIN_NAME, 'compute.errors');
|
|
|
24
24
|
// Fir apps keep no log history, so their session URL streams and never closes; the timeout also
|
|
25
25
|
// covers a Cedar logplex that stalls, so the one-shot fetch can never wait indefinitely.
|
|
26
26
|
export const LOGPLEX_FETCH_TIMEOUT_MS = 30_000;
|
|
27
|
+
// Cedar requests stay byte-for-byte as before: the Accept header is only added when SSE is wanted.
|
|
28
|
+
function requestInit(signal, sse) {
|
|
29
|
+
return sse ? { headers: { Accept: 'text/event-stream' }, signal } : { signal };
|
|
30
|
+
}
|
|
31
|
+
// A server that ignores the Accept header answers text/plain, which the SSE splitter would turn into
|
|
32
|
+
// nothing at all -- so the response, not the request, decides how it is parsed.
|
|
33
|
+
function createSplitterFor(response, sse) {
|
|
34
|
+
if (!sse) {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
const isSse = (response.headers.get('content-type') ?? '').toLowerCase().includes('text/event-stream');
|
|
38
|
+
return isSse ? createSseSplitter() : createNewlineSplitter();
|
|
39
|
+
}
|
|
40
|
+
function createNewlineSplitter() {
|
|
41
|
+
let buffer = '';
|
|
42
|
+
return {
|
|
43
|
+
flush() {
|
|
44
|
+
const rest = buffer;
|
|
45
|
+
buffer = '';
|
|
46
|
+
return rest.length > 0 ? [rest] : [];
|
|
47
|
+
},
|
|
48
|
+
push(chunk) {
|
|
49
|
+
const lines = (buffer + chunk).split('\n');
|
|
50
|
+
buffer = lines.pop() ?? '';
|
|
51
|
+
return lines;
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
// Events end at a blank line; an event's `data:` fields carry the record (id/comment/other fields
|
|
56
|
+
// are ignored). A trailing incomplete event is dropped, as the SSE spec does for a closed stream.
|
|
57
|
+
function createSseSplitter() {
|
|
58
|
+
let buffer = '';
|
|
59
|
+
return {
|
|
60
|
+
flush: () => [],
|
|
61
|
+
push(chunk) {
|
|
62
|
+
const events = (buffer + chunk).replaceAll('\r\n', '\n').split('\n\n');
|
|
63
|
+
buffer = events.pop() ?? '';
|
|
64
|
+
return events.flatMap(event => event
|
|
65
|
+
.split('\n')
|
|
66
|
+
.filter(field => field.startsWith('data:'))
|
|
67
|
+
.map(field => field.slice('data:'.length).replace(/^ /v, ''))
|
|
68
|
+
.join('\n')
|
|
69
|
+
.split(/\n+/v)
|
|
70
|
+
.filter(line => line.length > 0));
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
}
|
|
27
74
|
// On timeout, returns the partial output if any arrived rather than discarding it; throws only
|
|
28
|
-
// when nothing arrived before the deadline.
|
|
29
|
-
|
|
30
|
-
|
|
75
|
+
// when nothing arrived before the deadline. With `idleMs`, an idle gap ends the read cleanly
|
|
76
|
+
// (including with no output at all) instead of counting as a timeout.
|
|
77
|
+
export async function fetchLogplexOutput(logplexUrl, timeoutMs = LOGPLEX_FETCH_TIMEOUT_MS, options = {}) {
|
|
78
|
+
const { idleMs, sse } = options;
|
|
79
|
+
const deadline = AbortSignal.timeout(timeoutMs);
|
|
80
|
+
const idle = new AbortController();
|
|
81
|
+
const signal = idleMs === undefined ? deadline : AbortSignal.any([deadline, idle.signal]);
|
|
82
|
+
let idleTimer;
|
|
83
|
+
const armIdleTimer = () => {
|
|
84
|
+
if (idleMs === undefined) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
clearTimeout(idleTimer);
|
|
88
|
+
idleTimer = setTimeout(() => {
|
|
89
|
+
idle.abort();
|
|
90
|
+
}, idleMs);
|
|
91
|
+
};
|
|
92
|
+
let splitter;
|
|
93
|
+
const decoder = new TextDecoder();
|
|
94
|
+
const toOutput = (text) => splitter ? splitter.push(text).map(line => `${line}\n`).join('') : text;
|
|
95
|
+
const decode = (bytes) => toOutput(decoder.decode(bytes, { stream: bytes !== undefined }));
|
|
96
|
+
const finish = () => decode() + (splitter ? splitter.flush().map(line => `${line}\n`).join('') : '');
|
|
31
97
|
let output = '';
|
|
32
98
|
try {
|
|
33
|
-
const response = await fetch(logplexUrl,
|
|
99
|
+
const response = await fetch(logplexUrl, requestInit(signal, sse));
|
|
34
100
|
if (!response.ok) {
|
|
35
101
|
throw new Error(`HTTP ${response.status}`);
|
|
36
102
|
}
|
|
103
|
+
splitter = createSplitterFor(response, sse);
|
|
37
104
|
if (!response.body) {
|
|
38
|
-
return { output: await response.text(), timedOut: false };
|
|
105
|
+
return { output: toOutput(await response.text()), timedOut: false };
|
|
39
106
|
}
|
|
107
|
+
// Armed only once connected, so "idle" means connected-but-silent, not slow to connect.
|
|
108
|
+
armIdleTimer();
|
|
40
109
|
const reader = response.body.getReader();
|
|
41
|
-
const decoder = new TextDecoder();
|
|
42
110
|
while (true) {
|
|
43
111
|
// Sequential reads of one ordered stream -- there's nothing to parallelize.
|
|
44
112
|
// eslint-disable-next-line no-await-in-loop
|
|
@@ -46,11 +114,15 @@ export async function fetchLogplexOutput(logplexUrl, timeoutMs = LOGPLEX_FETCH_T
|
|
|
46
114
|
if (done) {
|
|
47
115
|
break;
|
|
48
116
|
}
|
|
49
|
-
|
|
117
|
+
armIdleTimer();
|
|
118
|
+
output += decode(value);
|
|
50
119
|
}
|
|
51
|
-
return { output: output +
|
|
120
|
+
return { output: output + finish(), timedOut: false };
|
|
52
121
|
}
|
|
53
122
|
catch (error) {
|
|
123
|
+
if (idle.signal.aborted && !deadline.aborted) {
|
|
124
|
+
return { output: output + finish(), timedOut: false };
|
|
125
|
+
}
|
|
54
126
|
if (signal.aborted) {
|
|
55
127
|
if (output.length > 0) {
|
|
56
128
|
return { output, timedOut: true };
|
|
@@ -59,6 +131,9 @@ export async function fetchLogplexOutput(logplexUrl, timeoutMs = LOGPLEX_FETCH_T
|
|
|
59
131
|
}
|
|
60
132
|
throw messages.createError('error.logStreamFailed', [error.message]);
|
|
61
133
|
}
|
|
134
|
+
finally {
|
|
135
|
+
clearTimeout(idleTimer);
|
|
136
|
+
}
|
|
62
137
|
}
|
|
63
138
|
// Bounded one-shot fetch, not a stream -- `get build-log` prints one finished-or-in-progress
|
|
64
139
|
// build's log, unlike `tail runtime-log`'s ongoing runtime stream. Explicit Accept: output_stream_url
|
|
@@ -75,19 +150,47 @@ export async function fetchBuildOutputStream(outputStreamUrl) {
|
|
|
75
150
|
throw messages.createError('error.buildOutputFetchFailed', [error.message]);
|
|
76
151
|
}
|
|
77
152
|
}
|
|
78
|
-
// Reports whether the stream ended because the server closed it (EOF)
|
|
79
|
-
// AbortSignal fired, rather than leaving the caller to
|
|
80
|
-
// the fact -- ambient signal state can flip between a
|
|
81
|
-
// misattributing one for the other.
|
|
82
|
-
export async function streamLogplexOutput(logplexUrl, onLine, signal) {
|
|
83
|
-
|
|
153
|
+
// Reports whether the stream ended because the server closed it (EOF), because it went silent
|
|
154
|
+
// (stalled), or because the caller's AbortSignal fired, rather than leaving the caller to
|
|
155
|
+
// re-derive that from signal.aborted after the fact -- ambient signal state can flip between a
|
|
156
|
+
// natural EOF and a same-instant abort, misattributing one for the other.
|
|
157
|
+
export async function streamLogplexOutput(logplexUrl, onLine, signal, options = {}) {
|
|
158
|
+
const stall = new AbortController();
|
|
159
|
+
const requestSignal = signal ? AbortSignal.any([signal, stall.signal]) : stall.signal;
|
|
160
|
+
let stallTimer;
|
|
161
|
+
const armStallTimer = () => {
|
|
162
|
+
if (options.stallMs === undefined) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
clearTimeout(stallTimer);
|
|
166
|
+
stallTimer = setTimeout(() => {
|
|
167
|
+
stall.abort();
|
|
168
|
+
}, options.stallMs);
|
|
169
|
+
};
|
|
84
170
|
try {
|
|
85
|
-
|
|
171
|
+
return await readLogplexStream(logplexUrl, onLine, signal, requestSignal, stall, armStallTimer, options);
|
|
86
172
|
}
|
|
87
|
-
|
|
173
|
+
finally {
|
|
174
|
+
clearTimeout(stallTimer);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
async function readLogplexStream(logplexUrl, onLine, signal, requestSignal, stall, armStallTimer, options) {
|
|
178
|
+
// An abort is either the caller's (stop) or the stall timer's (recreate); anything else is a failure.
|
|
179
|
+
const endedByAbort = () => {
|
|
88
180
|
if (signal?.aborted) {
|
|
89
181
|
return 'aborted';
|
|
90
182
|
}
|
|
183
|
+
return stall.signal.aborted ? 'stalled' : undefined;
|
|
184
|
+
};
|
|
185
|
+
let response;
|
|
186
|
+
try {
|
|
187
|
+
response = await fetch(logplexUrl, requestInit(requestSignal, options.sse));
|
|
188
|
+
}
|
|
189
|
+
catch (error) {
|
|
190
|
+
const ended = endedByAbort();
|
|
191
|
+
if (ended) {
|
|
192
|
+
return ended;
|
|
193
|
+
}
|
|
91
194
|
throw messages.createError('error.logStreamFailed', [error.message]);
|
|
92
195
|
}
|
|
93
196
|
if (!response.ok) {
|
|
@@ -101,7 +204,8 @@ export async function streamLogplexOutput(logplexUrl, onLine, signal) {
|
|
|
101
204
|
// actually returns.
|
|
102
205
|
const reader = response.body.getReader();
|
|
103
206
|
const decoder = new TextDecoder();
|
|
104
|
-
|
|
207
|
+
const splitter = createSplitterFor(response, options.sse) ?? createNewlineSplitter();
|
|
208
|
+
armStallTimer();
|
|
105
209
|
try {
|
|
106
210
|
while (true) {
|
|
107
211
|
// Sequential reads of one ordered stream -- there's nothing to parallelize.
|
|
@@ -110,25 +214,25 @@ export async function streamLogplexOutput(logplexUrl, onLine, signal) {
|
|
|
110
214
|
if (done) {
|
|
111
215
|
break;
|
|
112
216
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
for (const line of lines) {
|
|
217
|
+
armStallTimer();
|
|
218
|
+
options.onActivity?.();
|
|
219
|
+
for (const line of splitter.push(decoder.decode(value, { stream: true }))) {
|
|
117
220
|
onLine(line);
|
|
118
221
|
}
|
|
119
222
|
}
|
|
120
223
|
}
|
|
121
224
|
catch (error) {
|
|
122
|
-
|
|
123
|
-
|
|
225
|
+
const ended = endedByAbort();
|
|
226
|
+
if (ended) {
|
|
227
|
+
return ended;
|
|
124
228
|
}
|
|
125
229
|
throw messages.createError('error.logStreamFailed', [error.message]);
|
|
126
230
|
}
|
|
127
231
|
// Reaching here means reader.read() resolved with done:true, i.e. a genuine server-side close
|
|
128
232
|
// -- not an abort artifact (an aborted fetch rejects the read instead), so this is unambiguously
|
|
129
233
|
// EOF even if the signal happens to fire in the same tick.
|
|
130
|
-
|
|
131
|
-
onLine(
|
|
234
|
+
for (const line of splitter.flush()) {
|
|
235
|
+
onLine(line);
|
|
132
236
|
}
|
|
133
237
|
return 'eof';
|
|
134
238
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computeLogStream.js","sourceRoot":"","sources":["../../src/shared/computeLogStream.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAC,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAE1C,OAAO,EAAC,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 @@ This prints the most recent log lines and exits. To keep the session open and
|
|
|
12
12
|
stream new lines as they arrive, use compute tail runtime-log.
|
|
13
13
|
|
|
14
14
|
The recent lines come from the Cedar log buffer (about 1500 lines at most), so
|
|
15
|
-
--num can't return more than that. Fir apps keep no log history, so
|
|
16
|
-
command
|
|
15
|
+
--num can't return more than that. Fir apps keep no log history, so for them
|
|
16
|
+
the command reads the live log session instead and stops once it goes quiet
|
|
17
|
+
for a few seconds; it can only show output the session delivers in that
|
|
18
|
+
window, so --num doesn't apply; use compute tail runtime-log to follow a Fir app's log. The
|
|
17
19
|
command stops waiting after 30 seconds and prints whatever log lines it has
|
|
18
20
|
received by then; if none arrived, it fails with a timeout error.
|
|
19
21
|
|
|
@@ -33,14 +35,9 @@ directory's app name if that isn't set either.
|
|
|
33
35
|
|
|
34
36
|
Number of recent log lines to print.
|
|
35
37
|
|
|
36
|
-
#
|
|
38
|
+
# warning.generationUnknown
|
|
37
39
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
# error.firNoLogHistory.actions
|
|
41
|
-
|
|
42
|
-
- Run sf compute tail runtime-log to watch the live log instead.
|
|
43
|
-
- To learn how Fir differs from Cedar, see https://devcenter.heroku.com/articles/generations.
|
|
40
|
+
Couldn't tell whether %s is a Fir or Cedar app, so it's being read as a Cedar app. If it's a Fir app, its log output may be missing or delayed; run the command again.
|
|
44
41
|
|
|
45
42
|
# warning.logFetchPartial
|
|
46
43
|
|
|
@@ -44,6 +44,26 @@ Stopped tailing %s.
|
|
|
44
44
|
|
|
45
45
|
The log session for %s ended.
|
|
46
46
|
|
|
47
|
+
# info.tailReconnecting
|
|
48
|
+
|
|
49
|
+
The log session for %s expired; reconnecting.
|
|
50
|
+
|
|
51
|
+
# info.tailStalled
|
|
52
|
+
|
|
53
|
+
The log session for %s went quiet; reconnecting.
|
|
54
|
+
|
|
55
|
+
# info.tailRetrying
|
|
56
|
+
|
|
57
|
+
Lost the log session for %s (%s). Retrying in %s s (attempt %s of %s).
|
|
58
|
+
|
|
59
|
+
# warning.generationUnknown
|
|
60
|
+
|
|
61
|
+
Couldn't tell whether %s is a Fir or Cedar app, so it's being read as a Cedar app. If it's a Fir app, its log output may be missing or delayed; run the command again.
|
|
62
|
+
|
|
63
|
+
# warning.tailEndedWithoutOutput
|
|
64
|
+
|
|
65
|
+
The log session for %s closed without sending any log lines. The app may have produced no output yet; run the command again, or check that the app is running.
|
|
66
|
+
|
|
47
67
|
# examples
|
|
48
68
|
|
|
49
69
|
- Tail the log until stopped with Ctrl-C:
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@heroku/plugin-compute",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@heroku/plugin-compute",
|
|
9
|
-
"version": "0.4.
|
|
9
|
+
"version": "0.4.3",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@oclif/core": "^4",
|
package/oclif.manifest.json
CHANGED
|
@@ -986,7 +986,7 @@
|
|
|
986
986
|
"compute:get:runtime-log": {
|
|
987
987
|
"aliases": [],
|
|
988
988
|
"args": {},
|
|
989
|
-
"description": "Fetches a compute app's runtime log -- the app's ongoing output (request\nhandling, application logs), not the build/compile log; use compute get\nbuild-log for that.\n\nThis prints the most recent log lines and exits. To keep the session open and\nstream new lines as they arrive, use compute tail runtime-log.\n\nThe recent lines come from the Cedar log buffer (about 1500 lines at most), so\n--num can't return more than that. Fir apps keep no log history, so
|
|
989
|
+
"description": "Fetches a compute app's runtime log -- the app's ongoing output (request\nhandling, application logs), not the build/compile log; use compute get\nbuild-log for that.\n\nThis prints the most recent log lines and exits. To keep the session open and\nstream new lines as they arrive, use compute tail runtime-log.\n\nThe recent lines come from the Cedar log buffer (about 1500 lines at most), so\n--num can't return more than that. Fir apps keep no log history, so for them\nthe command reads the live log session instead and stops once it goes quiet\nfor a few seconds; it can only show output the session delivers in that\nwindow, so --num doesn't apply; use compute tail runtime-log to follow a Fir app's log. The\ncommand stops waiting after 30 seconds and prints whatever log lines it has\nreceived by then; if none arrived, it fails with a timeout error.\n\nThis is an org-mediated operation by --name (the app's DeveloperName) -- the\norg creates a log session with Heroku on your behalf and hands back a\nshort-lived, pre-authorized URL that the CLI reads from directly. It doesn't\nread from or require a local Salesforce DX project.",
|
|
990
990
|
"examples": [
|
|
991
991
|
"Print the most recent log lines:\n<%= config.bin %> <%= command.id %> --name CreditRatingScorer --target-org my-org",
|
|
992
992
|
"Print the most recent 500 log lines:\n<%= config.bin %> <%= command.id %> --name CreditRatingScorer --num 500 --target-org my-org"
|
|
@@ -1517,5 +1517,5 @@
|
|
|
1517
1517
|
]
|
|
1518
1518
|
}
|
|
1519
1519
|
},
|
|
1520
|
-
"version": "0.4.
|
|
1520
|
+
"version": "0.4.3"
|
|
1521
1521
|
}
|